Re: gnuplot help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Subject: Re: gnuplot help
>> 
>> On 2015-11-10 19:04, Antonio Olivares wrote:
>>> The only one that works is the following one:
>>> 
>>> http://plotshare.com/index.ws/plot/858779550
>>> 
>>> I wanted to change it, put the dates and the opponent and make it look
>>> like a bar graph.  I tried modifing the code and add the style used by
>>> Marco F. a fellow Fedora/open source user:
>>> 
>>> http://www.techrepublic.com/blog/linux-and-open-source/how-to-handle-time-based-data-with-gnuplot/
>>> 
>>> But I cannot get it to work.
>> 
>> Hi Antonio,
>> "Marco F. a fellow Fedora/open source user" here. Thanks for
>> your interest in my pieces.
>> 
>> It's been a while since I last seriously worked with Gnuplot,
>> so I am not really current about it anymore, and cannot
>> promise anything :-) Whoever is more up to date than me, please step in!
>> 
>> This said, my understanding is that the actual code you are trying to
>> make
>> work is NOT the one visible at the plotshare urls you provided,
>> which is only an example.
>> 
>> Is this correct? If yes, I (and I think the others too) would need to
>> see the WHOLE gnuplot code and data files that you tried to run, and
>> the complete error message you get. If I'm wrong, please explain. In
>> any case, we'd need to see at least the complete error message, to
>> continue.
>> 
>> HTH,
>> Marco
>> 
>> --
>> http://mfioretti.com
> 
> Yes and no.  The data is the same, and I tried to modify it but was
> getting things wrong.  The plotshare url that is there works.
> 
> [olivares@localhost tmp]$ cat gfga2015.plt
> #set term pngcairo size 800,600 transparent nocrop enhanced font
> 'Verdana,11'#define axis
> #set style line 11 lc rgb '#808080' lt 1
> #set border 3 back ls 11
> set tics nomirror
> 
> #define key
> set key opaque
> 
> # define grid
> #set style line 12 lc rgb '#808080' lt 0 lw 1
> #set grid back ls 12
> 
> # define linecolors
> set style line 1 lc rgb '#0060ad' pt 2 ps 1 lt 1 lw 2 # --- blue
> set style line 1 lc rgb '#8b1a0e' pt 1 ps 1 lt 1 lw 2 # --- red
> set style line 2 lc rgb '#5e9c36' pt 6 ps 1 lt 1 lw 2 # --- green
> 
> #set key bottom right
> 
> set xlabel 'Game '
> set ylabel 'Goals scored'
> #set xrange [0:1]
> #set yrange [0:1]
> set grid
> set xdata time
> set timefmt "%Y%m%d"
> set xtics border in scale 1,0.5 rotate by -90 nomirror offset character
> 0, 0, 0
> 
> plot 'gfga2015.dat' u 1:2 t 'Grulla Goals Scored' w lp ls 1,
> 'gfga2015.dat' u 1:3 t 'Opponents Goals' w lp ls 2
> [olivares@localhost tmp]$ cat gfga2015.dat
> # Date   GF GA#Opponent
> 20150103 0 10 # Edinburg Vela
> 20150106 1 0 # Zapata
> 20150113 2 0 # Lyford
> 20150116 0 0 # Roma
> 20150120 0 3 # Mercedes
> 20150123 1 2 # Laredo Nixon
> 20150203 8 1 # Zapata
> 20150210 1 9 # Hidalgo
> 20150213 3 1 # Raymondville
> 20150216 1 0 # Monte Alto
> 20150220 0 0 # Zapata
> 20150226 0 4 # Hidalgo
> 20150306 2 2 # Raymondville
> 20150317 6 1 # Monte Alto
> 20150326 3 0 # Port Isabel
> 20150403 0 7 # Rockport-Fulton
> 
> But I changed it to the above with the dates and it works, but the dates
> don't get formated like I would like.  Also our games are on Tues and
> Fridays of every week except on tournaments and scrimmages, I wanted to
> change the code to represent that, and no matter how much I try I get
> tics at two or three spaces using part of the examples, ie.,
> 
>   set xtics format "%b %d"
> 
>   set xtics "20110105", 259200, "20110430"
> 
> 259200 for 3 days difference
> 172800 for 2 days tics apart and so on.
> 
> 
> I add this to the script and I get different results, If I include tics
> at 1 unit apart, then thing get messy.  I want to look at a nice graph.
> The one at url
> 
> http://plotshare.com/index.ws/plot/338384601
> 
> I got it to work on my desktop, but I do not know enough of gnuplot for
> it to just plot on top of quadrant 1 and not go below.  Here's the code.
> 
> [olivares@localhost tmp]$ cat 2015gfga.plt
> #set terminal postscript eps color solid
> set border linewidth 1.5
> set style histogram errorbars linewidth 1.5
> set style data histograms
> set style fill solid 1 border -1
> set ylabel "Goals Scored" font "Helvetica,16"
> set xtics border in scale 1,0.5 rotate by -90 nomirror offset character
> 0, 0, 0
> #set xtics border in scale 1,0.5 rotate by -45 nomirror offset character
> 0, 0, 0
> set grid
> #set xdata time
> #set timefmt "%Y%m%d"
> #set xtics ( 'Edinburg Vela' 20150103, 'Zapata' 20150106, 'Lyford'
> 20150113, 'Roma' 20150116, 'Mercedes' 20150120, 'Laredo Nixon' 20150123,
> 'Zapata' 20150203, 'Hidalgo' 20150210, 'Raymondville' 20150213, 'Monte
> Alto' 20150217, 'Zapata' 20150220, 'Hidalgo' 20150227, 'Raymondville'
> 20150306, 'Monte Alto' 20150317, 'Port Isabel' 20150326, 'Rockport
> Fulton' 20150403  ) rotate by 90 right
> set ytics 1 nomirror
> set key top left
> #Start of user script
> #---------------------
> ExtData1 = '2015gfga.dat'
> plot '2015gfga.dat' using 3:2:xtic(1) title col lc rgb '#084594',
> '2015gfga.dat' using 2:3:xtic(1) title col lc rgb '#f6e8c3'
> [olivares@localhost tmp]$ cat 2015gfga.dat
> Test Opponents Grulla  Opponents
> 1-Edinburg-Vela 0 10
> 2-Zapata 1 0
> 3-Lyford 2 0
> 4-Roma 0 0
> 5-Mercedes 0 3
> 6-Laredo-Nixon 1 2
> 7-Zapata 8 1
> 8-Hidalgo 1 9
> 9-Raymondville 3 1
> 10-Monte-Alto 1 0
> 11-Hidalgo 0 4
> 12-Raymondville 2 2
> 13-Monte-Alto 6 1
> 14-Port-Isabel 3 0
> 15-Rockport-Fulton 0 7
> [olivares@localhost tmp]$
> 
> I would like to change the numbers 1 to 20150103 display it along with
> the opponent, but things get messy so my best guess would be to just
> format it manually instead of experimenting things out.  If anyone can
> help me fix/adjust the code so that It just prints the bar graphs of
> opponents goals vs our goals and not go below to quadrant 3 please let me
> know.
> 
> Best Regards,
> 
> 
> Antonio

I replied to Marco and thought that I automagically replied to the list.  I got it to work by manually changing the data with the dates:

2015gfga.dat 
--------------------------------
Test Opponents Grulla  Opponents
2015/01/03-Edinburg-Vela 0 10
2015/01/06-Zapata 1 0
2015/01/13-Lyford 2 0
2015/01/16-Roma 0 0
2015/01/20-Mercedes 0 3
2015/01/23-Laredo-Nixon 1 2
2015/02/03-Zapata 8 1
2015/02/10-Hidalgo 1 9
2015/02/13-Raymondville 3 1
2015/02/17-Monte-Alto 1 0
2015/02/20-Zapata 0 0 
2015/02/26-Hidalgo 0 4
2015/03/06-Raymondville 2 2
2015/03/17-Monte-Alto 6 1
2015/03/26-Port-Isabel 3 0
2015/04/03-Rockport-Fulton 0 7

then modified 2015gfga.plt and added a range 
set yrange [0:10] 
will fix the graph to what I would like 

[olivares@localhost tmp]$ cat 2015gfga.plt
---------------------------------------------------
#set terminal postscript eps color solid
set border linewidth 1.5
set style histogram errorbars linewidth 1.5
set style data histograms
set style fill solid 1 border -1
set ylabel "Goals Scored" font "Helvetica,16"
set xtics border in scale 1,0.5 rotate by -90 nomirror offset character 0, 0, 0
#set xtics border in scale 1,0.5 rotate by -45 nomirror offset character 0, 0, 0
set grid
#set xdata time
#set timefmt "%Y%m%d"
#set xtics ( 'Edinburg Vela' 20150103, 'Zapata' 20150106, 'Lyford' 20150113, 'Roma' 20150116, 'Mercedes' 20150120, 'Laredo Nixon' 20150123, 'Zapata' 20150203, 'Hidalgo' 20150210, 'Raymondville' 20150213, 'Monte Alto' 20150217, 'Zapata' 20150220, 'Hidalgo' 20150227, 'Raymondville' 20150306, 'Monte Alto' 20150317, 'Port Isabel' 20150326, 'Rockport Fulton' 20150403  ) rotate by 90 right
set ytics 1 nomirror
set key top left
#Start of user script
#---------------------
ExtData1 = '2015gfga.dat'
plot '2015gfga.dat' using 3:2:xtic(1) title col lc rgb '#084594', '2015gfga.dat' using 2:3:xtic(1) title col lc rgb '#f6e8c3'

I had in the last line

plot 'ExtData1' using 3:2:xtic(1) title col lc rgb '#084594', '' using 2:3:xtic(1) title col lc rgb '#f6e8c3'

and gnuplot was reporting an error.  I modified it to above and removed ExtData1 reference and it worked.  

I tried to set the xtics manually and change them according to Marco's reference, but the graph did not refect all the games so I modified the data file and added the date and the opponent and then modified the range to prohibit the line going below and keep everything in quadrant I. If anyone has a nicer way to make the graph look better, or format it using something else please help.  I would like for our athletes to see what we need to work on the Goal Differential and not allow too many goals against us.  

Best Regards,


Antonio

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux