# Multigraph with a linear & a log axis (data set)

**URL:** <https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032>\
**Category:** Newbie\
**Tags:** root\
**Created:** [March 14, 2023, 9:35pm UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032 "2023-03-14T21:35:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeetJ](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@GeetJ](https://root-forum.cern.ch/u/GeetJ)\
**Post date:** [March 14, 2023, 9:35pm UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032/1 "2023-03-14T21:35:35Z")

</div>

Hi,  
I have the following data sets:  
(a) linear X-axis + linear Y1-axis with asymmetric errors  
(b) linear X-axis + logarithmic Y2-axis with symmetric errors.  
How do I have them on the same plot together? Use multigraph?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 15, 2023, 5:49am UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032/2 "2023-03-15T05:49:07Z")

</div>

Welcome to the ROOT forum.

> [@GeetJ](#):
>
> Use multigraph?

Yes. A [TMultiGraph](https://root.cern.ch/doc/master/classTMultiGraph.html).

---

<div class="post-metadata">

**Author:** ![GeetJ](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@GeetJ](https://root-forum.cern.ch/u/GeetJ)\
**Post date:** [March 15, 2023, 7:30pm UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032/3 "2023-03-15T19:30:49Z")

</div>

Thanks couet for replying.  
I am unable to have a linear Y1 axis (left) for linear data points and a logarithmic Y2 axis (right) for logarithmic data points. Since my data points have asymmetrical errors on them, I don’t want to scale my data points.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 15, 2023, 7:54pm UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032/4 "2023-03-15T19:54:42Z")

</div>

> [@Draw two graphs on one canvas with different Y scales](https://root-forum.cern.ch/t/draw-two-graphs-on-one-canvas-with-different-y-scales/21755):
>
> Hello. I have two data files and macro. And I need to draw two graphs on one canvas with different Y scales. I have read specific topic in ROOT manual, but unfortunately it hasn’t helped me. Can you help me please to solve this problem. Thank you. [comp.C](https://root-forum.cern.ch/uploads/default/original/2X/f/f23ff1366aca54ab333f5a47d008b50d9a25913e.C) (1006 Bytes)

---

<div class="post-metadata">

**Author:** ![GeetJ](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@GeetJ](https://root-forum.cern.ch/u/GeetJ)\
**Post date:** [March 15, 2023, 7:58pm UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032/5 "2023-03-15T19:58:45Z")

</div>

I worked it out by using the transparent pad method:

> [@How to plot with a linear and log scale on two different axes on same plot?](https://root-forum.cern.ch/t/how-to-plot-with-a-linear-and-log-scale-on-two-different-axes-on-same-plot/27008):
>
> I am trying to figure out how to plot something on a linear axis and then plot another quantity on a log axis on the same plot and then have the two y-axes be on different scales as well. I’m currently attempting to do this with drawing the first histogram on a TPad and then drawing the second histogram on a transparent TPad above it. However, I am not sure how to get a log scale for the second histogram (the log scale is a property of the TCanvas I think, not a TPad) and then how to use TGaxis …

However, there are 2 X-axes that are created since the 1st dataset is in X-range of [0,50] and 2nd dataset is in [20,30]. How to plot the 2nd dataset on the X-axis of the 1st dataset?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 15, 2023, 8:02pm UTC](https://root-forum.cern.ch/t/multigraph-with-a-linear-a-log-axis-data-set/54032/6 "2023-03-15T20:02:43Z")

</div>

> [@Problem in setting the range of the plot](https://root-forum.cern.ch/t/problem-in-setting-the-range-of-the-plot/50089/10):
>
> Actually, for “graphs”, it is very easy to use any “arbitrary values” for the x-axis range: graph-\>GetHistogram()-\>GetXaxis()-\>SetLimits(xmin, xmax);
