FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

enable 2x (retina) display by minrk · Pull Request #3381 · ipython/ipython · GitHub

Repository navigation

enable 2x (retina) display - #3381

Merged
ivanov merged 4 commits into
ipython:masterfrom
minrk:retina
Jun 28, 2013
Merged

ivanov merged 4 commits into
ipython:masterfrom
minrk:retina

Conversation

minrk commented May 29, 2013

Copy link
Copy Markdown
Member

works for matplotlib figures with:

InlineBackend.figure_format = 'retina'

and (embedded) Image objects with:

Image(data,...retina=True)

ref #2234

Carreau commented Jun 1, 2013

Copy link
Copy Markdown
Member

Could the 2x factor be modifiable ? We're starting to see higher resolution that have bastard format that are not 2x (Chromebook pixel IIRC) .
I'm convince that their are only few users, but having a Bool would change the api in the future if we want multiple option.
If you think that unnecessary for now, that also fine with me.

minrk commented Jun 1, 2013

Copy link
Copy Markdown
Member Author

could introduce an arbitrary scale factor, I guess.

Carreau commented Jun 2, 2013

Copy link
Copy Markdown
Member

could introduce an arbitrary scale factor, I guess.

Up to you, You probably have more devices with variable resolutions around you than I do.

Copy link
Copy Markdown
Member

I don't think we need to do the arbitrary scale factor yet. I don't have a retina screen to test, but the code looks good.

ivanov added a commit that referenced this pull request Jun 28, 2013
ivanov merged commit d820363 into ipython:master Jun 28, 2013

ivanov commented Jun 28, 2013

Copy link
Copy Markdown
Member

we figured that we can add the arbitrary factor later, so decided to merge as is.

minrk deleted the retina branch June 28, 2013 23:11
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014

Copy link
Copy Markdown

The command %config InlineBackend.figure_format = 'retina' appears to work well in Jupiter Notebooks but not in qtconsole. Any ideas why?

Copy link
Copy Markdown
Member

@chuckdries, that's becauser qtconsole is not using Qt5, I think. According to Qt release notes, the first version that truly solves retina display problems is Qt 5.6 (released a couple of weeks ago :-)

Copy link
Copy Markdown
Member

Qtconsole can run on PyQt5, I believe. I suspect there's something the qtconsole code needs to do to display the image at double-resolution, though.

Copy link
Copy Markdown
Member

Yes, Qtconsole can run on PyQt5, but Anaconda (at least) is not using it. But I thought just setting retina for InlineBackend.figure_format was enough to have 2x images.

@minrk, is that not the case?

minrk commented Apr 15, 2016

Copy link
Copy Markdown
Member Author

That's enough for the spec, but I'm not sure if the qtconsole handles it.

wjakob commented Aug 19, 2016

Copy link
Copy Markdown

Specifying

InlineBackend.figure_format = 'retina'

at the beginning of every notebook indeed does the job of providing images at the right resolution, but it's unfortunate that this is always necessary as High-DPI displays are fairly common nowadays.

It is possible to get a cross-platform pixel density value from the browser (javascript or CSS resolution query). To me, this seems like a much more robust and user-friendly way to do this automatically.

dkasak commented Jun 24, 2017 •
edited
Loading

Copy link
Copy Markdown

Is there a reason this is not the default, at least for notebooks? The out-of-the-box experience for notebooks is pretty bad right now on a higher resolution screen, with both graphics and text very visibly blurry.

Carreau commented Jun 24, 2017

Copy link
Copy Markdown
Member

Is there a reason this is not the default, at least for notebooks? The out-of-the-box experience for notebooks is pretty bad right now on a higherG resolution screen, with both graphics and text very visibly blurry.

Yes: Because the kernel does not know it is controlled from a notebook. And even if it is controlled from a notebook it does not mean the notebook is on hi-DPI screen.

dkasak commented Jun 24, 2017

Copy link
Copy Markdown

Ah, the first part explains it. As was mentioned before, it would probably be possible to query the DPI value. Would it make more sense then to implement this in Jupyter by making it send this command when the python kernel is used?

Carreau commented Jun 24, 2017 via email

Copy link
Copy Markdown
Member

dkasak commented Jun 24, 2017 •
edited
Loading

Copy link
Copy Markdown

You can't really do that either, as the frontend try to be as agnostic as possible WRT what language is implemented in the back end and sending that command would be an IPython specific thing. Also nothing guarantee that the kernel is connected to a single client ( which is even more true with RT collaboration comming soon) in which case "connected to Hi DPI" is not a binary choice.

That sounds reasonable and I realize the frontend is maximally agnostic of the backend by design. On the other hand, this particular situation is less than ideal and seems to point to a possible deficiency in the abstraction from a usability point of view. Perhaps there is a need for a way to specify some backend-specific configuration in Jupyter?

I'm also trying to consider what a higher-by-default figure resolution would imply for lower resolution screens. I'm not too familiar with the current architecture of Jupyter, but I suppose there isn't any scaling involved so the figure would simply appear larger than usual? I'm wondering whether this is perhaps a more graceful kind of failure than displaying blurry images. Then again, if there isn't any scaling involved, I'm not sure why I even saw blur as opposed to just a very small (but sharp) figure.

I guess a first reasonable step would be to at least make the syntax for this a bit less arcane and awkward, such as was suggested in #3982. %matplotlib inline retina or %matplotlib inline svg seem much cleaner than %config InlineBackend.figure_format = 'retina'

ellisonbg commented Jun 24, 2017 via email

Copy link
Copy Markdown
Member

Carreau commented Jun 24, 2017

Copy link
Copy Markdown
Member

I do probably agree that it is time to update the default on this. I agree
that kernels should be agnostic to frontends, but the current default is
biased towards particular frontends with low resolution rendering. I don't
know the numbers, but high resolution screens are extremely popular these
days. I have been embarrassed multiple times showing people matplotlib on
my laptop and having to explain to them why it looks bad. Defaulting to
something that looks good everywhere is a safe bet in my mind.

I am also +1 for making the API simpler to adjust. That way if folks have
large notebooks and need the lower resolution, it is easy to set it.

If/when we change, I would consider that close to breaking API so I would prefer to have it in a major version of IPython/IPykernel.

ellisonbg commented Jun 24, 2017 via email

Copy link
Copy Markdown
Member

Copy link
Copy Markdown

Running notebook server 5.4.0 and iPython 6.3.1, and using:

%matplotlib inline
import matplotlib
%config InlineBackend.figure_format = 'retina'
from matplotlib import pyplot as plt
plt.plot([1,2,3,4,5])

Seems to have no effect. I can set:

matplotlib.rcParams['figure.dpi'] = 144

When running matplotlib to get retina-resolution images, but these are then displayed double-size in my notebooks.

Has something changed recently to make this fix no longer function, or am I doing something stupid at my end?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants


Back | FazBrowse Home | New Git URL