|
From: Christian J. <chr...@gm...> - 2015-03-09 18:35:07
|
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.xlabel('Frame')
plt.show()
<matplotlib.figure.Figure at 0x11b1f2090>
On Mon, Mar 9, 2015 at 6:16 PM, Benjamin Root <ben...@ou...> wrote:
> 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 <sm...@fu...>
> 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, Christian Jorgensen <chr...@gm...>
>> wrote:
>>
>> >
>> > 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 explicitly defined.
>> >
>> >
>> >
>> > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote:
>> > 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 there is a better way to do this, but here is a
>> quick-n-dirty example that can get you where you want. Just modify the
>> formatter used by the tickers to report the value as divided by 10.
>> > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html
>> >
>> > Cheers!
>> > Ben Root
>> >
>> >
>> > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen<chr...@gm...>
>> wrote:
>> > How can I scale my x-axis [0,3000] for the data to now correspond/show
>> up
>> > as [0, 300]?
>> >
>> >
>> > In xmgrace, this is done with a linear transformation, but I cannot seem
>> > to find the command to do this with matplotlib.
>> >
>> > Best
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> > by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> > things parallel software development, from weekly thought leadership
>> blogs to
>> > news, videos, case studies, tutorials and more. Take a look and join the
>> > conversation now. http://goparallel.sourceforge.net/
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>> >
>> >
>> >
>> >
>> > --
>> > _______
>> >
>> > Christian Jørgensen
>> >
>> >
>> >
>> > --
>> > _______
>> >
>> > Christian Jørgensen
>> >
>> ------------------------------------------------------------------------------
>> > Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> > by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> > things parallel software development, from weekly thought leadership
>> blogs to
>> > news, videos, case studies, tutorials and more. Take a look and join the
>> > conversation now.
>> http://goparallel.sourceforge.net/_______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> things parallel software development, from weekly thought leadership
>> blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
--
_______
Christian Jørgensen
|