Re: mixing histogram with lines?



Hello,

I managed to use histogram with gnuplot, and now I came across a
plotting problem that I almost gave in.

Here's a data set like

"method A" "method B" "method C"
Total 6.641302e-002 8.061306e-002 2.705582e-001
Iteration 2.172000e+002 1.850000e+002 1.690000e+002

and I'd like to use histogram to show 'Total' and lines to show
'Iteration'. So, the plot I'd like to draw is gonna be a mix of
histogram and lines. I've searched to find out some similar examples to
get some idea of how to draw it and tried a couple of things, but
nothing worked out well. Now I'm a bit skeptical the plot I wanted
might not be possible with gnuplot. :(

I'd like to get any advice from gnuplot users to address my problem.
I'd appreiciate it if someone would help me for this plotting problem.
Thank you in adv.

I am not sure I understood exactly what you want, but I'll give it a try. The basic way to plot different datasets in a single graph is to just enumerate the plot commands:

plot data1 with boxes, data2 with lines, data3 with points ...

(This is just to illustrate the principle. For the example to work, data1-3 are need to be defined as variables containing the names of input files.)

To plot your data, I would do something like this:

------------------------------------------------------
reset
unset multiplot

set xtics ("Method A" 0, "Method B" 1, "Method C" 2)
set xtics out nomirror
set ytics out nomirror
set y2tics out nomirror
set xrange [-1:3]
set yrange [0:0.4]
set y2range [100:250]
set ylabel "Total"
set y2label "Iteration"

plot '-' w boxes title "Total", '-' w lines axes x1y2 title "Iteration"
6.641302e-002
8.061306e-002
2.705582e-001
e
2.172000e+002
1.850000e+002
1.690000e+002
e
------------------------------------------------------

Here, the '-' indicates that inline data are to be used, which are given at the end of the plot command. Note that I used the y2 axis for the Iteration data set, because the numbers there are much larger than for Total.

HTH,

Michael.
.



Relevant Pages

  • Re: mixing histogram with lines?
    ... My original intention was to add a line plot to a histogram plot that I already made, which turned out impossible after several trials. ... Iteration 2.172000e+002 1.850000e+002 1.690000e+002 ... Note that I used the y2 axis for the Iteration data set, because the numbers there are much larger than for Total. ...
    (comp.graphics.apps.gnuplot)
  • Re: For vs. For Each
    ... The foreach implementation is flawed because the container is marked as ... readonly during the iteration. ... I don't see these guys on trial for that crime so i am ... > particular test data set, then you may very well create a situation where ...
    (microsoft.public.dotnet.languages.vb)
  • Re: For vs. For Each
    ... The foreach implementation is flawed because the container is marked as ... readonly during the iteration. ... I don't see these guys on trial for that crime so i am ... > particular test data set, then you may very well create a situation where ...
    (microsoft.public.dotnet.framework)
  • Re: For vs. For Each
    ... The foreach implementation is flawed because the container is marked as ... readonly during the iteration. ... I don't see these guys on trial for that crime so i am ... > particular test data set, then you may very well create a situation where ...
    (microsoft.public.dotnet.general)
  • Re: For vs. For Each
    ... The foreach implementation is flawed because the container is marked as ... readonly during the iteration. ... I don't see these guys on trial for that crime so i am ... > particular test data set, then you may very well create a situation where ...
    (microsoft.public.dotnet.languages.csharp)

Loading