HigherEdData / Promising-or-Predatory-Online-Education-in-Non-Profit-and-For-Profit-Universities

By Christian Smith ** DATA: BPS12 * IPEDS Online Enrollment * IPEDS Fall Enrollment by Race * IPEDS Financial Aid and Net Price * IPEDS Graduation
2 stars 0 forks source link

graphs not displaying in jupyter notebook using stata kernel #7

Open calvarez55 opened 3 years ago

calvarez55 commented 3 years ago

Hi all,

I am having an issue displaying graphs within the jupyter notebook while using the stata kernel. I think I have the same issue discussed here. I am using Stata 17.

For example, when I input the following code:

// Dataset with test scores
use "https://stats.idre.ucla.edu/stat/stata/notes/hsb2", clear
scatter read math, title("Reading score vs Math score")
scatter math science, title("Math score vs Science score")

The output I get is:

(highschool and beyond (200 cases))

file C:/Users/acade/.stata_kernel_cache/graph1.svg saved as SVG format
file C:/Users/acade/.stata_kernel_cache/graph1.pdf saved as PDF format

file C:/Users/acade/.stata_kernel_cache/graph2.svg saved as SVG format
file C:/Users/acade/.stata_kernel_cache/graph2.pdf saved as PDF format

Is anyone else having this issue with Stata 17?

Thanks!

charlieeatonphd commented 3 years ago

Hi Camila. Thanks for sharing this!

I have a couple questions:

  1. Are you working on a Linux machine or a Windows machine using Ubuntu for Windows or something like that?

  2. Did you install the Stata Kernel as follows?

pip install git+https://github.com/mcaceresb/stata_kernel.git@dev-stata17-graph-fix

It may be possible to fix your problem by adjusting the graph settings in the stata_kernel.conf file as is described here: https://kylebarron.dev/stata_kernel/using_stata_kernel/configuration/

As is explained here, there are some graphing issues specific to Windows that can be resolved by using png or other graph formats https://kylebarron.dev/stata_kernel/using_stata_kernel/intro/#displaying-graphs

This means changing the stata_kernel.conf file to the following:

graph_format = png

This can be done with a text editor or using the following magics within your Jupyter Notebook to modify the configuration file:

%set graph_format png --permanently

It looks like graph_epstopng_program is another configuration setting recently developed to address these types of issues. It is also described here:

https://kylebarron.dev/stata_kernel/using_stata_kernel/configuration/

calvarez55 commented 3 years ago

Hi Charlie, Thank you for posting these solutions! I tried those out. Unfortunately they didn't work.

I am going to try to re-install the kernel using Stata 16 to see if that works.

I am learning a lot through this troubleshooting process. :)