|
From: Martín M. <mar...@gm...> - 2020-06-09 12:35:16
|
Hi,
I'm building my first scripts with PyX trying to replace my old bash +
gnuplot scripts. Most of my work moves around plotting output from log
files that are sent to me so I can get a graphical idea of what's happening.
I want to plot graphs with time span on the x axis and numerical values
(number of transactions, number of connections, etc.) on the y axis.
This is what I have so far. Each entry from the fulldata dictionary and the
ts list have exactly the same len() and are all lists. This is an example
with the 'waittime' entry, but same thing happens with any entry of the
dictionary:
```
attrs = [color.gradient.RedBlue]
g = graph.graphxy(width=600, key=graph.key.key())
g.plot(graph.data.values(x=ts, y=fulldata["waittime"]),
[graph.style.line(attrs),
graph.style.symbol(graph.style.symbol.changesquare,
symbolattrs=attrs, size=0.1)])
g.writeEPSfile("waittime")
g.writePDFfile("waittime")
```
On running this I get the following error:
```
Traceback (most recent call last):
File "build_graf.py", line 59, in <module>
g.writeEPSfile("waittime")
File "/usr/lib64/python3.7/site-packages/pyx/canvas.py", line 50, in
wrappedindocument
return method(d, file, **write_kwargs)
File "/usr/lib64/python3.7/site-packages/pyx/document.py", line 185, in
writeEPSfile
pswriter.EPSwriter(self, f, **kwargs)
File "/usr/lib64/python3.7/site-packages/pyx/pswriter.py", line 142, in
__init__
page.processPS(pagefile, self, acontext, registry, pagebbox)
File "/usr/lib64/python3.7/site-packages/pyx/document.py", line 132, in
processPS
self._process("processPS", *args)
File "/usr/lib64/python3.7/site-packages/pyx/document.py", line 78, in
_process
bbox.set(self.canvas.bbox()) # this bbox is not accurate
File "/usr/lib64/python3.7/site-packages/pyx/graph/graph.py", line 181,
in bbox
self.finish()
File "/usr/lib64/python3.7/site-packages/pyx/graph/graph.py", line 303,
in finish
self.doaxes()
File "/usr/lib64/python3.7/site-packages/pyx/graph/graph.py", line 580,
in doaxes
self.dolayout()
File "/usr/lib64/python3.7/site-packages/pyx/graph/graph.py", line 564,
in dolayout
self.doaxiscreate(axisname)
File "/usr/lib64/python3.7/site-packages/pyx/graph/graph.py", line 240,
in doaxiscreate
self.axes[axisname].create()
File "/usr/lib64/python3.7/site-packages/pyx/graph/axis/axis.py", line
591, in create
self.canvas = self.axis.create(self.data, self.positioner,
self.graphtexrunner, self.errorname)
File "/usr/lib64/python3.7/site-packages/pyx/graph/axis/axis.py", line
250, in create
return _regularaxis._create(self, data, positioner, graphtexrunner,
self.parter, self.rater, errorname)
File "/usr/lib64/python3.7/site-packages/pyx/graph/axis/axis.py", line
116, in _create
raise RuntimeError("incomplete axis range %s" % errorname)
RuntimeError: incomplete axis range for axis x
```
BTW, I had to fix the formatting in axis.py as there was a mistake which
made the `raise` not work. Where can I send patches? I'm using rpm
packages, version 0.14.1.
Any help on how to fix the error from above, or better ways to build my
graphs would be much appreciated. :-)
Kind regards, Martín
--
Martín Marqués
It’s not that I have something to hide,
it’s that I have nothing I want you to see
|