pypi sbmlsim 0.7.2

6 hours ago

Release notes for sbmlsim 0.7.2

sbmlsim

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.name is the text a figure renders and it was computed once, in the constructor, so axis.unit = "week" or axis.label = "duration" left the old label on the plot. label, unit and name are properties now and name is derived from the other two, so a change of either is reflected; name is still the complete axis label and overrides them, and setting it to None hands 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") rendered time [None] and Axis(unit="week") rendered None [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. time and [week], and a dimensionless unit is written as - as before
  • copying an axis keeps its reverse flag. Axis.__copy__ did not pass it, so a plot which was copied, i.e. every plot of Figure.add_plots and of create_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.reverse did nothing unless both bounds were set. It swapped min and max instead of inverting the axis, so a reversed axis with only a lower bound assigned None. The bounds are the bounds and reverse is the direction they are drawn in
  • Style.resolve_style rewrote 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 of Line, Marker or Fill ever had, so the line type, the marker type and its edge, and the second fill colour were never inherited at all
  • Style.__copy__ dropped base_style and Plot.__copy__ dropped yaxis_right
  • a plot knows its figure. A plot resolves its data through its figure and only add_plots associated the two, so plot.figure and plot.experiment raised for every plot of Figure.from_plots or of add_subplot
  • : is the dotted linestyle of matplotlib. The mapping carried the marker . in its place, so the canonical spelling raised a KeyError; the aliases matplotlib accepts for a shape the model has are understood, and a shape it cannot express raises a ValueError which names what it can
  • settings which were never rendered. Plot.facecolor was built, defaulted and read by no serializer, and the capsize of a curve was defaulted, dropped by Style.from_mpl_kwargs and 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 is None, which the fallback to an empty Axis made unreachable together with the ValueError about a plot with curves and no axes
  • yaxis_right is type checked like the other two axes, the span messages of Figure.add_subplot print the number they test, and Figure.from_plots takes the optional experiment Figure.__init__ takes
  • the Zenodo badge and the citation of the README, the documentation index and CITATION.cff carried 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 DOI 10.5281/zenodo.3597770 now (#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 plot and not with errorbar, 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_visible hides the tick labels with tick_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 from add_gridspec
  • legend_position was 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

Don't miss a new sbmlsim release

NewReleases is sending notifications on new releases.