I have to use different csv files to create plots out of them in the same figure. My coding environment is google colab (it's like Jupyter notebook in google's cloud). So I decided to create a figure and then loop through the files and do the plots. It looks something like this:
import healpy as hp
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(16,12))
ax = fig.add_subplot(111)
for void_file in ['./filepath1.csv','./filepath2.csv','./filepath3.csv', ...]:
helper_image = hp.gnomview(void_file, .....)
data = func1(helper_image, .....)
plt.plot(len(data), data, ......)
What I want is to only add into the figure the plots created with the line plt.plot(len(data), data, ......)
, but what happens is that also the helper images from the line helper_image = hp.gnomview(....)
sneak into the image and spoil it (healpy
is a package for spherical data). The line helper_image = ....
is only there to make some necessary calculations, but unfortunately they come along with plots.
How can I suppress the creation of the plots by helper_image = hp.gnomview(....)
? Or can I somehow tell the figure or ax
to include only plots that I specify? Or are there any easy alternatives that don't require a loop for plotting? Tnx
CodePudding user response:
you can use return_projected_image=True
and no_plot=True
keyword arguments, see https://healpy.readthedocs.io/en/latest/generated/healpy.visufunc.gnomview.html