Release notes for sbmlsim 0.7.2
A patch release of the plotting: the axis labels of a figure, an inspection of the figure model and of its matplotlib rendering, and the citation.
Fixes
- the axis label follows the label and the unit (#167).
Axis.nameis the text a figure renders and it was computed once, in the constructor, soaxis.unit = "week"oraxis.label = "duration"left the old label on the plot.label,unitandnameare properties now andnameis derived from the other two, so a change of either is reflected;nameis still the complete axis label and overrides them, and setting it toNonehands the axis back to its label and its unit. A copied axis keeps that distinction, i.e. a derived label stays derived instead of being pinned to the text it had when it was copied - an axis without a unit is not labelled
[None].Axis("time")renderedtime [None]andAxis(unit="week")renderedNone [week], since the part which was not given was formatted into the label anyway. A part which is missing is left out now, i.e.timeand[week], and adimensionlessunit is written as-as before - copying an axis keeps its
reverseflag.Axis.__copy__did not pass it, so a plot which was copied, i.e. every plot ofFigure.add_plotsand ofcreate_plots, lost the flag which inverts the axis - the spines of a missing axis were the spines of the other one. A plot without an x axis hid the left and the right spine, i.e. the sides of the y axis, and kept the line of the axis it was hiding; they are also hidden on the panel itself rather than on whatever the styling loop before them had left over
Axis.reversedid nothing unless both bounds were set. It swappedminandmaxinstead of inverting the axis, so a reversed axis with only a lower bound assignedNone. The bounds are the bounds andreverseis the direction they are drawn inStyle.resolve_stylerewrote the style it derives from. It returned the base style itself and assigned onto it, so resolving one derived style changed the base and every other style sharing it; and it looked the inherited attributes up under the camel case names of SED-ML, which no field ofLine,MarkerorFillever had, so the line type, the marker type and its edge, and the second fill colour were never inherited at allStyle.__copy__droppedbase_styleandPlot.__copy__droppedyaxis_right- a plot knows its figure. A plot resolves its data through its figure and only
add_plotsassociated the two, soplot.figureandplot.experimentraised for every plot ofFigure.from_plotsor ofadd_subplot :is the dotted linestyle of matplotlib. The mapping carried the marker.in its place, so the canonical spelling raised aKeyError; the aliases matplotlib accepts for a shape the model has are understood, and a shape it cannot express raises aValueErrorwhich names what it can- settings which were never rendered.
Plot.facecolorwas built, defaulted and read by no serializer, and thecapsizeof a curve was defaulted, dropped byStyle.from_mpl_kwargsand merged from an empty dictionary, so no error bar ever had a cap - code which could not run:
interp,Figure._area_interpolation_points, and the branches for an axis which isNone, which the fallback to an emptyAxismade unreachable together with theValueErrorabout a plot with curves and no axes yaxis_rightis type checked like the other two axes, the span messages ofFigure.add_subplotprint the number they test, andFigure.from_plotstakes the optional experimentFigure.__init__takes- the Zenodo badge and the citation of the README, the documentation index and
CITATION.cffcarried the GitHub repository id and the concept DOI of sbmlutils, so every Zenodo link of sbmlsim resolved to the sbmlutils archive; they use the sbmlsim concept DOI10.5281/zenodo.3597770now (#206)
Plotting
- the rendering does not go through the global state of
pyplot.plt.figure()keeps every figure it creates in a global registry until someone closes it, so a library which renders many leaks them and matplotlib warns from the twentieth on, while a fit report draws about seventy. The serializer creates the figure itself, as the matplotlib documentation asks of a library; showing a figure is the one thing which needs a manager and gets one there - a curve without error data is drawn with
plotand not witherrorbar, which builds the containers of the bars whether or not there are any: 8.13 ms to 7.70 ms for a panel of ten curves, and 0.278 ms to 0.120 ms for the draw call itself, the rest being the resolution of the data and the conversion of its units ticks_visiblehides the tick labels withtick_params, which is correct for any locator and which an empty list of tick labels is not; a spine which is not drawn is hidden rather than painted in the colour of the figure, which only worked while the panel had that colour; a curve kept out of the legend is labelled_nolegend_, which is what matplotlib documents; and the grid of the figure comes fromadd_gridspeclegend_positionwas read for a plot with one y axis only; a plot with a right y axis puts the curves of both axes into one legend when the legend is outside, since two of them would sit on top of each other
Documentation
- Plots and reports no longer says that a figure is exported to SED-ML, which was removed in 0.7.0, and names both backends rather than matplotlib alone; the axis label and what follows what is described where the axis is