[matplotlib-devel] Code Review Request
tcaswell suggested (https://github.com/matplotlib/matplotlib/issues/2972) I put together this example when I realized the difference between interpolation = 'none' and interpolation = 'nearest' in imshow(). The docstring for imshow() mentions this difference, but pictures are worth a thousand words. Here is the summary of my changes: https://github.com/Stretch97/matplotlib/compare/master...image-interpolation-example This is my first contribution to matplotlib. I presume I wait until someone reviews my changes, and, if everything is ok, I submit a pull request. -Ben Reedlunn (Stretch97) -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] bbox images move when figure is saved to pdf
I wondered if someone could take a look at Issue #3918 (https://github.com/matplotlib/matplotlib/issues/3918). As you can see in my last two posts, everything works fine if I have one bbox image or if I don't save as a pdf. However, if I have two bbox images, the images move when I save as a pdf. This seems like a relatively small issue to fix, so I have tried to debug the problem, but I have been unable to find the source of the issue. If anyone could point me toward where the problematic code is, I would be happy to fix it, test it, and submit the PR. -Ben (Stretch97) -- New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Produce text runs in the postscript backend
I am in favor of such a change. I also have rcParams['pdf.fonttype'] = 42, so I can use Adobe Illustrator to tweak my mpl generated plots. Changing a word in Illustrator becomes quite a pain when every glyph is a separate text box. -Ben Reedlunn On Feb 18, 2015, at 8:52 AM, Eric Moore wrote: > Hi, > > I posted on the user list a while back about saving editable text using the > postscript backend [1]. There I was informed that this was changed a few > years ago to individually place glyphs. It looks to me, that this change was > about correctly supporting unicode in this backend [2]. > > Would the project be open to changing this to produce text runs when all of > the characters are ascii? This way, the general unicode case should still > work but runs of text where the special handling is not necessary should > result in editable text. I'm happy to work up a patch, but I don't want to > spend the time if there is no hope of it being merged. > > My use case is to be able to make some tweaks to figures post mpl. In my > case this tends to be to either combine figures from several sources into a > single coherent figure or to adjust the figure size or spacing slightly so > the final figure fits into the space available. All of this can be done in > mpl directly, but in terms of effective use of my time, opening the figure in > Corel Draw, Inkscape or Illustrator is much faster since I can get the figure > 90% of the way there quickly and easily using mpl. > > Eric > > 1. http://thread.gmane.org/gmane.comp.python.matplotlib.general/34816 > 2. > https://github.com/matplotlib/matplotlib/commit/80321a3b489994748b79e41bc34a65f836a9a03f > -- > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Incorporating TikZ into Matplotlib
Neil,I have attached code to draw the arrowhead.-Ben# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import custom_annotations import matplotlib.pyplot as plt plt.figure() ax = plt.subplot(111) length = 20.0 head_length = 7.0 #Convert the head length from mm into points (1/72") head_length_pts = head_length * 72.0/25.4 #Calculate the head width head_aspect_ratio = 2.5 head_width_pts = head_length_pts / head_aspect_ratio #Define arrow style style_str = '-)>' arrowstyle_str = style_str + ', head_width = ' + str(head_width_pts) + \ ', head_length = ' + str(head_length_pts) + ', length = ' + str(length * 72/25.4) #Sets arrow orientation x_1 = [0.25, 0.5] #Sets arrowhead tip position x_2 = [0.5, 0.5] ax.annotate('', xytext = x_1, textcoords = 'axes fraction', \ xy = x_2, xycoords = 'axes fraction', clip_on = False, \ arrowprops = dict(arrowstyle = arrowstyle_str, mutation_scale = 1.0, \ linewidth = 1, facecolor = [0,0,0], connectionstyle = 'arc3', \ shrinkA = 0, shrinkB = 0))On May 13, 2015, at 7:44 PM, Neil Girdhar <mistersh...@gmail.com> wrote:Do you have the code that you used to draw the arrowhead? I'm up to date now on the development workflow (http://matplotlib.org/devel/gitwash/development_workflow.html), so I'm ready to start working.Thanks,NeilOn Wed, May 13, 2015 at 9:10 PM, Benjamin Reedlunn <breed...@gmail.com> wrote:Yes, I fully agree that we need to unify the many different ways to draw arrows. Neil, in case an example would be helpful for you, I have attached a module that includes a custom arrowhead class. The arrowhead class works with the with the ax.annotate() method. (I like the annotate method because it allows me to easily mix and match coordinate systems for arrow placement.) As you can see in the attached pdf, the custom arrowhead doesn't include fancy Bezier curves, but that could be added.-BenOn May 13, 2015, at 2:54 PM, Thomas Caswell <tcasw...@gmail.com> wrote:The other thing that should be done is to unify the (I think 7?!?) unique ways to draw arrows in mpl.On Wed, May 13, 2015 at 4:52 PM Neil Girdhar <mistersh...@gmail.com> wrote:Yes, I just noticed that as well. That's how the tikz pgf code looks (a sequence of line_to and curve_to commands and so on) so it should be easy to port over the various shapes.On Wed, May 13, 2015 at 4:49 PM, Eric Firing <efir...@hawaii.edu> wrote:On 2015/05/13 10:12 AM, Neil Girdhar wrote: If you want to make arrowheads look at all decent, they really need to be enclosed in Bezier curves. See the diagram here: Mpl paths support Bezier curves. http://matplotlib.org/api/path_api.html?highlight=bezier http://tex.stackexchange.com/questions/150289/how-do-you-accomplish-stealth-with-the-new-arrows-meta/230965#230965 The first two look like garbage. The last one is the only one that looks good imho. That depends on the application, and the observer.Sure, but I may as well port them all of the tikz arrowheads over since most of the work would be figuring out how to do it. Eric Best, Neil On Wed, May 13, 2015 at 4:09 PM, Eric Firing <efir...@hawaii.edu efir...@hawaii.edu>> wrote: On 2015/05/13 9:36 AM, Neil Girdhar wrote: I don't know matplotlib well enough (yet) to know what the change would consist of. I suggest you take a look at the beautiful tikz manual: http://pgf.sourceforge.net/pgf_CVS.pdf Very helpful, thank you. The arrows.meta on page 201–212 are really well-designed and beautiful. Compare this with matplotlib's custom arrows: http://stackoverflow.com/questions/16968007/custom-arrow-style-for-matplotlib-pyplot-annotate How do I make tikz's arrowheads available for all backends? My guess offhand is that this is a matter of using the mpl API. I don't think we would want to add all of these types and options to the mpl core; but a toolkit might be ideal for this. The mpl API, which generates the same results for all backends, is quite complete and flexible. Things like arrowheads are Patch objects, and you can specify any path you want. The main trick is figuring out how to handle transforms--what kind of coordinates should the path be specifying? How should things scale as a figure is reshaped and resized? For many of these types you could also use mpl Line2D objects, for which several properties including cap style can be specified. Not all of the TikZ options would be available, but perhaps enough. Eric -- One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applica