Unfortunately, Sage doesn't *yet* have this capability. It will in
the near future.
> It will in the near future.
Are you thinking of the matplotlib html5 canvas backend that is being
developed? Or is there something else that you are doing?
I'm going to do *something*. I think there are numerous ways to solve
this problem if one tries hard. First I would do something with
infrastructure, but of course that's just one thing.
Well, then just for reference, here is a recent matplotlib thread from
someone working on an html5 canvas backend to matplotlib:
They might be interested in collaborating, or motivated if they saw
their work being used immediately.
Of course, this doesn't address moderately old or dysfunctional browsers
that don't have html5 canvas.
It's not finished. Here is a demo of what gnuplot can do with an html5
(notice the coordinates at the bottom of the plot).
careful knowledge of how matplotlib coordinates correspond to png
You can get the transform that describes the display pixel -> data
coordinates straight from matplotlib. We could ship that to the browser
with the plot, then the browser could do the matrix multiplication on
"You can use the inverted() method to create a transform which will take
you from display to data coordinates:
In : inv = ax.transData.inverted()
In : type(inv)
Out: <class 'matplotlib.transforms.CompositeGenericTransform'>
In : inv.transform((335.175, 247.))
Out: array([ 5., 0.])
It would also be useful to peruse the definition of the transformation
Here's an example of the matplotlib canvas backend:
(it doesn't have the coordinate tracking feature implemented, I think).
You can't use "show". Use "savefig", as in:
The sage notebook automatically displays any graphic file you generate
in a cell. That's why we need to save the figure to a graphics file,
like test.png. Then the notebook comes along, sees that the cell
generated a graphic file, and displays it.
> *However, the code in cell 4, is where I really need the help. The
> code in cell 4 is suppose to display the xy data at a certain location
> on the line plot. I have looked at this for a while, but I am
> confused as to why it doesn't work. This code was also taken from the
> mathplotlib website. Any help on this in particular would be neat.
> In my spare time, I will continue to work on this.
Just change the last line to "plt.savefig..." just like the first cell.
It's not "savefile", it's "savefig" :).