On Wed, Dec 5, 2018 at 12:09 PM MinRK <
benja...@gmail.com> wrote:
>
> The kernel is never told that it has been started by a notebook (indeed, a kernel can have a console and notebook connected to it at the same time),
I'm aware that a kernel can have multiple Jupyter clients connected at
the same time, but I was still hoping that some specific configuration
can be provided when starting the kernel (because there will only ever
be one entity that starts a kernel, right?).
> so there isn't any information that can be reliably interrogated to determine that the kernel is attached to a notebook (or may be in the future).
Sure, that's fine, but is it possible to provide a given piece of
configuration depending on who (Qt Console or Notebook/JupyterLab)
starts the kernel?
As I mentioned in my previous email, I'm talking about the "figure.dpi" setting.
The Notebook needs a setting like this to display PNG plots in the
right size (i.e. the same size that a SVG plot would have in the
browser or a PDF plot would have in LaTeX/PDF):
c.InlineBackend.rc = {'figure.dpi': 96}
The Qt Console, however, needs this (which is the default setting when
using ipykernel):
c.InlineBackend.rc = {'figure.dpi': 72}
I've created a notebook with a few more details:
http://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/plotting/matplotlib-inline-defaults.ipynb
The problem is that one setting will only be correct for either the Qt
Console or for the Notebook, never for both. So I thought it would be
at least helpful to use the right settings for Notebook in those cases
where the kernel was started by the Notebook app (or JupyterLab).
I've somewhere read about a file named
~/.jupyter/jupyter_notebook_config.py, which sounds like it would be
the right place to put such a configuration, but the
"c.InlineBackend.rc" setting didn't have any effect when I tried it
there.
I've also mentioned the problem there:
https://github.com/ipython/ipykernel/issues/267#issuecomment-441069321
cheers,
Matthias
> To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/CAHNn8BWBF%3DpfrUBzKs55YYobb3De%2BSqFxNz%2B0jq1pLfG8oeQ2A%40mail.gmail.com.