You might need to put parentheses around the statement for the lambda...
formatter = FuncFormatter(lambda x, pos: ("%d" % x/10))
Also, a tweak to my code. Change most of the "plt" to "ax" and use the
appropriate methods. I suspect that the ipython session you are in is
messing up the pyplot state
I want to thank the users for their invaluable help.
My final error concerns the plotting:
in (x, pos)> 1 formatter
= FuncFormatter(lambda x, pos: "%d" % x/10) 2 3 fig, ax =
plt.subplots() 4 ax.yaxis.set_major_formatter(formatter) 5
a= plt.plot(D.dtrajs[0])
TypeErro
Sterling,
this doesn't work, as it's using the array as a function
x = D.dtrajs[0](range(len(D.dtrajs[0])))
plt.plot(D.dtrajs[0])
plt.ylabel('O2-Fe distance')
plt.xlabel('Frame')
---TypeError
Thanks,
I ran Benjamin's code but it doesn't display the
figure anymore. It only prints a text about the figure
formatter = FuncFormatter(lambda x, pos: "%d" % x/10)
fig, ax = plt.subplots()
ax.yaxis.set_major_formatter(formatter)
plt.plot(D.dtrajs[0])
plt.ylabel('O2-Fe distance')
plt.xl
Or just do this:
formatter = FuncFormatter(lambda x, pos: "%d" % x/10)
fig, ax =
plt.subplots()ax.yaxis.set_major_formatter(formatter)plt.plot(D.dtrajs[0])
plt.ylabel('O2-Fe distance')
plt.xlabel('Frame')
plt.show()
On Mon, Mar 9, 2015 at 2:11 PM, Sterling Smith
wrote:
> Christian,
>
> To de
That was untested. It should start with (still untested)
x = array(range(len(array))
On Mar 9, 2015, at 11:11AM, Sterling Smith wrote:
> Christian,
>
> To define your x coordinate, try
> x = range(len(array))
> x = x/10.
> plot(x,array)
>
> -Sterling
>
> On Mar 9, 2015, at 10:57AM, Christi
Christian,
To define your x coordinate, try
x = range(len(array))
x = x/10.
plot(x,array)
-Sterling
On Mar 9, 2015, at 10:57AM, Christian Jorgensen wrote:
>
> My array does not have an explicit x-coordinate
> representation. The x-coordinate is simply the index.
>
> print(array)
> [ 0 0 20
My array is called D.dtrajs[0]
I'm plotting it as
plt.plot(D.dtrajs[0])
plt.ylabel('O2-Fe distance')
plt.xlabel('Frame')
There is thus no x-variable defined to
scale or modify. How would you do this?
>
>
> On Mon, Mar 9, 2015 at 6:03 PM, Benjamin Root wrote:
>
>> I am not sure I understand
I am not sure I understand. I took your question as "how do I make my x
tick labels show values as [0, 300] when my values really are [0, 3000]?".
Are the indexes you speak of ranging from 0 to 3000? If so, I don't see how
our examples aren't sufficient. As for formatting x "because it is not
defin
> My array does not have an explicit x-coordinate
> representation. The x-coordinate is simply the index.
>
> print(array)
> [ 0 0 20 ..., 8 8 8]
>
>
> Thus what I would like is to adjoin the element
> index as another row, how is this possible?
>
>
> I cannot format x because it is not explici
Ok, this really should be simple (and I am sure it is), but I cannot, for
the life of me, find the appropriate documentation for it. We need better
documentation about how to utilize the offset-text feature of tickers. It
can be either a multiple offset or an additive offset.
In any case, I know t
Christian,
It sounds like you want to rescale your x axis values before plotting or use
the x axis formatter. For the latter see
http://matplotlib.org/examples/pylab_examples/major_minor_demo1.html
http://matplotlib.org/examples/pylab_examples/custom_ticker1.html
-Sterling
On Mar 9, 2015, at 1
12 matches
Mail list logo