Hello!

I have recently found out about matplotlib, and at the same time I am having
problems using gnuplot. So I want to convert :-)
However, as I am also quite new to python I have a somewhat steep learning
curve.

It is really only one simple gnuplot script I want to convert, and I have
come
a little bit on the way. Hopefully someone here can provide the last pieces.
Let me show the gnuplot script I am trying to convert:

set terminal png
set title "Historical issue count"
set xlabel "Date"
set xdata time
set timefmt "%Y%m%d%H%M"
set format x "%d/%m"
set ylabel "Issue count"
set xtics nomirror
set ytics nomirror
set border 3
# You should set size before going to multiplot
set size 1.0,1.0
set multiplot
set size 0.5,1
set origin 0,0
plot "< tail -20 last_issues_count_file.txt" using 1:2 title 'Issues' with
linespoints
set title "Number of test cases"
set ylabel "Test cases"
set origin 0.5,0
plot "< tail -20 number_test_cases_file.txt" using 1:2 title 'Tests' with
linespoints

This is it. The script is a multiplot script, but how to do that part with
matplotlib
I think I can work out myself. I am printing two graphs that contain
"issues" and "tests".
These values are displayed over time. The data looks like this (both input
files):

200711291206 52
200711291257 52
200711291359 52
200711291710 52
200711300633 52
200711300916 42
200712030635 42
200712040635 42

Now, I am able to correctly display the second column in matplotlib. Here's
my initial attempt:

# load the issues data
X = load('C:/Users/Daniel.SBG/Desktop/last_issues_count_file.txt')
# select last 50 issues
s = X[:,1][-50:]
# make a nice plot
plot(s, linestyle='-', marker='+', color='red')

This is fine, I can set titles, lables, and legend. But I am missing the
dates on the x-axis.
What I try is this:

# the date format in my input file:
timefmt = '%Y%m%d%H%M'
# create a date formatter (not sure this is the intended purpose)
monthsFmt = DateFormatter(timefmt)
# access the axis
ax = subplot(111)
# set formatter of the axis
ax.xaxis.set_major_formatter(monthsFmt)

This doesn't do anything useful by itself though. I am unsure how to parse
the date column in
my input file and use that as the independent variable of my plots. At the
same time I'd like
to have some nice date formatting on the x-axis.

Any help on these issues are very much appreciated (I don't enjoy gnuplot
anymore...)!
I can probably work from there on.

Thanks in advance!


-- 
Daniel Lidström
SBG AB

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to