I have a plot that I am trying to save with plotnine.
w = 10
h = 5
p9.ggsave(heatmap,plotName, width=w, height= h, dpi=300, limitsize=False)
For some reason I keep getting the following error:
TypeError Traceback (most recent call last)
c:\Users\s2997324\Bond University\Research Data - ENHANCE_Survey\DataExtraction\ENHANCESurvey\ENHANCESurvey\ENHANCESurveyAnalysis\Script2Analysis.ipynb Cell 57 line 8
83 w = 10
84 h = 5
86 p9.ggsave(heatmap,plotName, width=w, height= h, dpi=300, limitsize=False)
File c:\Users\s2997324\AppData\Local\anaconda3\lib\site-packages\plotnine\ggplot.py:644, in ggplot.save(self, filename, format, path, width, height, units, dpi, limitsize, verbose, **kwargs)
596 def save(
597 self,
598 filename: Union[str, Path] | None = None,
(...)
607 **kwargs: Any,
608 ):
609 """
610 Save a ggplot object as an image file
611
(...)
642 Additional arguments to pass to matplotlib `savefig()`.
643 """
644 sv = self.save_helper(
645 filename=filename,
646 format=format,
647 path=path,
648 width=width,
...
336 ar.sort()
337 aux = ar
338 mask = np.empty(aux.shape, dtype=np.bool_)
TypeError: '<' not supported between instances of 'str' and 'float'
I'm not really sure what I'm doing wrong as it worked the other day...
I've tried a few different ways of saving but it hasn't worked.
Just read the error carefully.
There happens some forbidden comparison between different data types. Most likely you pass some string as an argument. Even though python is not an explicitly type language, comparison between different data types would end up in error ("Fail fast" principle) instead of trying to continue with some behavior (as it is in Javascript for example).