Ask Your Question
2

Background for plot should include axes and labels

asked 2021-04-27 13:45:35 +0200

erentar gravatar image

updated 2021-04-27 21:42:21 +0200

slelievre gravatar image

Plots in Jupyter: Mathematica vs Sage

Below are four versions of a same plot in Jupyter notebooks in JupyterLab:

  • light theme vs dark theme
  • Mathematica vs Sage, using the Wolfram Language kernel and the SageMath kernel

To reproduce, either use the notebooks: mathematica | sage, or use the following code snippet:

f = 8.252e-5 - 0.035e-10*x
I = (0, 1e5)
labels = ["altitude in meters", "force difference in newtons"]
plot(f, I, axes_labels=labels)

and in JupyterLab, select light or dark via the "Settings > JupyterLab Theme" menu.

Light theme

Left: Mathematica. Right: SageMath.

Dark theme

Left: Mathematica. Right: SageMath.

Observation

In the SageMath plots,

  • the font size is inconsistent between the axis labels and tick labels
  • the white background does not include the axes or tick labels if the plot does not extend to an area covering them; as a consequence, in dark mode,

    • the y-axis label and y-axis tick labels,
    • the x-axis, x-axis label and x-axis tick labels,

    are black on a black background, and cannot be seen.

Question

Could i make the background permanently opaque, and permanently change the font size to something more reasonable like Mathematica has for reference?

edit retag flag offensive close merge delete

Comments

To see larger versions of the pictures, right-click them (or control-click on macOS) and select "Open image in new tab" from the contextual menu offered by your browser.

slelievre gravatar imageslelievre ( 2021-04-27 15:59:16 +0200 )edit

slelievre, thank you very much, this looks much better.

erentar gravatar imageerentar ( 2021-04-27 16:20:32 +0200 )edit

This is now tracked at

Thanks for opening that ticket.

slelievre gravatar imageslelievre ( 2021-05-13 21:01:38 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-04-28 11:46:44 +0200

eric_g gravatar image

This answers only the question about the font size: use the option axes_labels_size in plot() to set the relative size between the axes labels and the tick labels. The default value is 1.6, which is fine for LaTeX-typset axes labels, but may be too large for non-typeset ones. Use axes_labels_size=1 to get the same size as for the tick labels. See axes_labels_size and show options.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-04-27 13:45:35 +0200

Seen: 72 times

Last updated: Apr 28