IEP / Matplotlib on Retina Mac

169 views
Skip to first unread message

samuel...@gmail.com

unread,
Dec 8, 2015, 11:49:04 PM12/8/15
to Interactive Editor for Python
Hello.  Just recently got a new retina mac.  When I downloaded IEP the text was blurry, but then I downloaded a program called "Retinizer", and was able to get the IEP application to display at a higher resolution.

However, when I plot with matplotlib, the figure windows that are created are blurry.  Anyway to fix this on a retina mac?

Ludo Visser

unread,
Dec 9, 2015, 6:59:21 AM12/9/15
to ie...@googlegroups.com
I have a Early 2015 MacBook Pro (Retina, 13-inch) and everything looks
fine here. Can you make a screenshot showing the problem? I don't
think it is IEP related...

- Ludo
> --
> You received this message because you are subscribed to the Google Groups
> "Interactive Editor for Python" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to iep_+uns...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Almar Klein

unread,
Dec 9, 2015, 7:11:46 AM12/9/15
to Ludo Visser, ie...@googlegroups.com

There might be a difference to using the IEP binary and running IEP on pyqt4 obtained via macports/brew.

samuel...@gmail.com

unread,
Dec 9, 2015, 1:19:41 PM12/9/15
to Interactive Editor for Python
There are dpi and rcparams and figure width/length parameters to adjust in matplotlib.  I think that by adjusting the correct parameters it is possible to get high resolution figures with matplotlib.  I was able to use the 'savefig' function to SAVE my figures in high-resolution by using the 'dpi' parameter set to 220.  Here is a screenshot comparing low resolution (left) vs high resolution (right).  

To get the high resolution figure I put in my script file:

plt.savefig('Test Figure.png', dpi=220)


If I don't put in the dpi parameter, the saved figure looks blurry on the retina screen.

The problem I have is with the interactive figures being blurry.  Not sure how to increase the dpi with the interactive figures.  I'm sure there is a way to do it.  I found a github page that has some functions for plotting figures on retina/high resolution displays, but I'm not sure how to adapt this code for use in script files in IEP.

samuel...@gmail.com

unread,
Dec 9, 2015, 1:48:30 PM12/9/15
to Interactive Editor for Python, samuel...@gmail.com
Okay, I think I may have figured it out, sort of.
It looks like PyQt4 Gui doesn't support retina/high res displays yet.  

When I switched to the "Tk - Tk widget toolkit" gui in IEP shell settings, the interactive windows are now in retina display.  No need to mess around with any dpi settings.  Just pt.plot() as normal, and Tk shows the figure very sharp on the retina screen.

However, when using plt.savefig() I still have to use the dpi parameter to save the figure as a sharp image.

-Samuel

samuel...@gmail.com

unread,
Dec 9, 2015, 1:59:54 PM12/9/15
to Interactive Editor for Python, samuel...@gmail.com
Follow up to my previous post:
I have uploaded a screenshot showing difference between PyQt4 (left) and Tk gui (right)

As you can see, the Tk interactive window is at the higher retina resolution.  

Tk seems just a tad slower when using the zoom in window function.  However, I like that the Tk shell allows for keyboard shortcuts like minimize and close.
Hopefully, this helps out others in the future.  

-Samuel

Ludo Visser

unread,
Dec 10, 2015, 9:03:46 AM12/10/15
to ie...@googlegroups.com, samuel...@gmail.com
Interesting observation. I hadn't really noticed that it was blurry
on the Retina, but I guess I didn't look close enough. I still don't
really see a difference between using the PyQt4 or TK GUIs in IEP
though. You didn't make changes to the backend in your matplotlibrc
file?

- Ludo

samuel...@gmail.com

unread,
Dec 10, 2015, 12:24:04 PM12/10/15
to Interactive Editor for Python, samuel...@gmail.com
Nope.  The only thing I changed was that in the IEP shell configuration I changed the gui configuration to Tk gui instead of the PyQt4 gui.  I don't even know how to make changes in the matplotlibrc file.
Reply all
Reply to author
Forward
0 new messages