Menu

Problem with label when plotting histograms and a filledcurve

Help
Feitan
2017-07-20
2017-07-20
  • Feitan

    Feitan - 2017-07-20

    Hello,

    I have some problem to plot histograms and a filledcurve on the same plot. With the following script I got a massive shift of my second plot to the left (due to the "unset label"). Without the unset label I have an overlap of the labels.
    There are something wrong in my code but I have no idea about that.

    Here is my *.gnu

    set term png enhanced font '/usr/share/fonts/liberation/LiberationSans-Regular.ttf' 12
    file_name = "spectra_Tb161"
    
    set output file_name . '.png'
    
    set multiplot
    
    set nokey
    set yrange [1e-4:]
    set xrange [0:590]
    set ylabel "Number of electrons per decay dN/dE (keV^{-1})"
    set xlabel "E (keV)"
    set logscale y
    set format y "%.1t x 10^{%3T}"
    set tics front
    show mytics
    show label
    
    plot [0:590] 0.00408-3.94723e-6*x-2.72775e-8*x**2+3.77383e-11*x**3 with filledcurve above x1=0 lt 1
    
    set label "b)" at graph 0.05,0.9 center font "/usr/share/fonts/liberation/LiberationSans-Regular.ttf,24"
    
    binwidth=3
    set boxwidth binwidth
    set style fill solid border -1
    
    unset xlabel
    unset ylabel
    
    plot 'auger_spectrum_Tb161.dat' using 1:2 smooth freq with boxes lt rgb "green"
    
    unset multiplot
    

    And here a part of my file auger_spectrum_Tb161.dat

    37.06   9.36E-003
    43.97   4.68E-003
    5.25    6.52E-001
    6.528   2.31E-001
    1.022   1.84E+000
    

    I tried to use

    plot 0.00408-3.94723e-6*x-2.72775e-8*x**2+3.77383e-11*x**3 with filledcurve above x1=0 lt 1, \
    'auger_spectrum_Tb161.dat' using 1:2 smooth freq with boxes lt rgb "green"
    

    But I have a superposition of y and xlabel, and don't find a solution to hide the second.

    Thank you for your help.

    Regards,

     
    • Hans-Bernhard Broeker

      The reason your two plots move relative to each other is that there are two plots, instead of one. "multiplot" is not the right tool for this job.

      don't find a solution to hide the second.

      The second ... what?

       
      • Feitan

        Feitan - 2017-07-21

        Hi and thank you Hans and Bastian.

        I was talking about the second x label (from second plot) who overlay the x label from the first plot.

        Your script does exactly what I want Bastian thank you very much ! I was complicated the problem for nothing with the multiplot...

        Thank you !

         
  • Bastian Märkisch

    I don't understand that "superposition of x and y label". Does the following not give the expected result?

    $data << EOD
    37.06   9.36E-003
    43.97   4.68E-003
    5.25    6.52E-001
    6.528   2.31E-001
    1.022   1.84E+000
    EOD
    
    set nokey
    set yrange [1e-4:*]
    set xrange [0:590]
    set ylabel "Number of electrons per decay dN/dE (keV^{-1})"
    set xlabel "E (keV)"
    set logscale y
    set format y "%.1t x 10^{%3T}"
    set tics front
    
    set label "b)" at graph 0.05,0.9 center font ",24"
    
    binwidth=3
    set boxwidth binwidth
    set style fill solid border -1
    
    plot \
    [0:590] 0.00408-3.94723e-6*x-2.72775e-8*x**2+3.77383e-11*x**3 with filledcurve above x1=0 lt 1, \
    $data using 1:2 smooth freq with boxes lt rgb "green"
    
     
    • Feitan

      Feitan - 2017-07-21

      Hi Bastian,

      Thank you, it works !

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.