Frix,
It may be useful to post the version and backend you are using to the list.
import matplotlib
print matplotlib.__version__
print matplotlib.get_backend()
Also, if you can format the code as a simple self-contained example, that would
help others confirm what you are seeing.
-Sterling
On Mar 26, 2013, at 12:01PM, Hackstein wrote:
> Hello everyone,
>
> I have two issues with my current projects:
>
> 1) I automatically generate plots of several data sets in a for-loop, all of
> which have the same shape of x and y values, but some of which have two of
> those data (i.e. graphs) sets per figure, others have only one.
> I create the legend by
>
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, borderaxespad=0.)
>
> which works perfectly if I plot two data sets (and therefore two labels) in a
> figure, but sometimes (not always) causes an error, if only one data set is
> plotted in a figure.
> The legend is this
>
> print ax.get_legend_handles_labels()
> ([<matplotlib.lines.Line2D object at 0x24b9550>], ['i_s'])
>
> and the error is
>
> File "/usr/lib64/python2.6/site-packages/matplotlib/offsetbox.py", line 76,
> in _get_packed_offsets
> sep = (total - sum(w_list)) / (len(w_list) - 1.)
> FloatingPointError: divide by zero encountered in double_scalars
>
> which I broke down to a problem with the" mode='expand'" parameter. It seems
> it cannot expand when the number of labels is 1. Strangely, however, that
> seems not always to be the case, since some of the plots with only one data
> set and one legend entry work without problems, but some raise an error.
>
> 2) Another problem occurs with the y-axis tick labels. Even if the y-values
> are quite ordinary (in the order of 10) the labels get scientific notation
> when the y-range is small (order 0.1). I don't know why that is and it only
> occurs then. When the y-range is larger (order of 1), the ticks get plain
> numbers. I tried to work around that with the following code, which did not
> work:
>
> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
> plt.plot(np.asarray(mod_mjd_list_i), np.asarray(x_i), 'r-', label = 'i_s') ax
> = plt.gca() formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5))
> formy.set_scientific(False)
> ax.yaxis.set_major_formatter(formy)
>
> Any ideas what I can do?
>
> Thanks,
> frix
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel® Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. $5K grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13.
> http://p.sf.net/sfu/intel_levelupd2d_______________________________________________
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users