has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
3.92k stars 210 forks source link

plotnine figure of ipynb with vscode is displayed too much larger than jupyter #720

Open cuttlefish44 opened 9 months ago

cuttlefish44 commented 9 months ago

I'm R and Python user and really grateful to your work (I LOVE plotnine, thanks very much !!!!)

Recently I noticed when I opneed the ipynb file at vscode, plotnine figure displayed too much larger. (note: seaborn (matplotlib) figure doesn't.)

I use plotnine v0.12.1, VScode v1.74.3 with python extension v2023.1.10062310 AND Jupyer extention v2022.11.1003412109. (Excuse me, It is very hard to update because of workplace security)

First image is jupyter and 2nd is vscode. Any help would be greatly appreciated.

import pandas as pd
import plotnine
from plotnine import *
import matplotlib.pyplot as plt
import seaborn as sns

print("plt_settings:", plt.rcParams["figure.figsize"], plt.rcParams["figure.dpi"])
print("plotnine*settings:", plotnine.options.figure_size, plotnine.options.dpi)

data = pd.DataFrame({"x": range(10), "y": range(10, 20)})

sns.scatterplot(data, x = "x", y = "y")
ggplot(data, aes("x", "y")) + geom_point()

jupyter image vscode image

has2k1 commented 9 months ago

I don't use vscode, so I cannot quickly look into this.

Does this happen for both these cases

  1. Notebook file with output plots
  2. Notebook file with output generated within vscode