Hi, I'm looking into replacing my MATLAB(R) plotting routines by something slicker, and quite naturally found matplotlib. It has all the capabilities that I would need, except that I can't yet transform my plots into TikZ. For MATLAB(R), I used this rather elaborate script <http://win.ua.ac.be/~nschloe/content/matlab2tikz>.
Well, I thought I can just go ahead and start writing and equivalent backend; the documentation is really nice and clear (quite unlike MATLAB's!) so it was no big problem to get into the concepts of the backend. I played around a little and thought about how I could implement this and that, and some questions arose which can maybe best answered here. For the sake of clarity, let me just give a snippet of Pgfplots (TikZ) code that I would like the backend to produce ===================== *snip* ===================== [...] \begin{semilogyaxis} [axis on top, xtick={2,4,6,8,10,12,14,16}, ytick={1e-15,1e-10,1e-05,1,100000}, xmin=0.000000e+00,xmax=1.700000e+01, ymin=1.000000e-15,ymax=1.000000e+05, xmajorgrids, ymajorgrids, title={$\norm{F(\psi)}_2$}, xlabel={$k$}, width=\figurewidth, height=\figureheight, scale only axis ] % Line plot \addplot [color=red,only marks,mark=*,mark options={solid,fill=red}] coordinates{ (1.000000e+00,3.206000e+01) (2.000000e+00,3.860000e+01) (3.000000e+00,1.421000e+03) (4.000000e+00,4.143000e+02) (5.000000e+00,1.445000e+02) (6.000000e+00,3.775000e+01) (7.000000e+00,7.455000e+00) (8.000000e+00,7.228000e-01) (9.000000e+00,2.275000e-02) (1.000000e+01,4.953000e-05) (1.100000e+01,9.718000e-10) (1.200000e+01,5.534000e-07) (1.300000e+01,4.217000e-11) (1.400000e+01,3.930000e-03) (1.500000e+01,2.067000e-07) (1.600000e+01,7.231000e-12) }; \end{semilogyaxis} [...] ===================== *snap* ===================== This yields a purely marker plot (without lines) on a coordinate system where the y-coordinate is log-scaled. You see that the code is rather semantic and can easily be edited (which is think is the whole point of Pgfplots as opposed to pure TikZ). Now, if for a matplotlib plot I had query functions for the the axes ranges, ticks, grids, titles, data values, and so on and so forth, it would be a more or less complicated parsing of those and creating what we see above. However, it seems to me that the concept of backends is different. draw_path() would be called to plot the graph itself, the coordinate axes, and basically everything that resembles a line, giving its outline (color, shape, markers, start and end points) but *no* semantic information, that is, whether the path is part of an axis, an arrow or whatever. Is that correct? Considering this, what do matplotlob masterbrains :) think would be a good way to extract Pgfplots code out of a matplotlib figure? Is a backend feasible at all? Would a function as "matplotlib2tikz( myFigure )" be more advisable, making use of all sorts of query functions? (Such as myFigure.axes.get_xlim() -- Does something like that exist at all?) Cheers, Nico ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel