Skip to content

Document that rcparam values are unquoted #3670

Open

Description

@kfiz

Hi,
I'm not able to specify the default marker in matplotlibrc.
I tried:
lines.marker : '.'
lines.marker : 'point'
and others. Nothing worked.
What's the right way to do it?
Sry for asking this on the bug tracker, but I didn't now where else to ask.

Cheers

Activity

  1. tacaswell commented on Oct 18, 2014

    @tacaswell
    Member

    What do you mean by 'not work' . Typically questions like this should go to the user mailing list (matplotlib-users@lists.sourceforge.net you have to sign up for the list to have posting rights) or stackoverflow.com .

  2. added this to the milestone on Oct 18, 2014
  3. kfiz commented on Oct 18, 2014

    @kfiz
    Author

    By "not working" I mean, that once I test these settings by trying to plot a scatter plot, I get an error message:
    "ValueError: Unrecognized marker style "." "
    Next time I'll address that on the mailing list, thanks.

  4. tacaswell commented on Oct 18, 2014

    @tacaswell
    Member

    And what version of mpl are you using?

  5. kfiz commented on Oct 18, 2014

    @kfiz
    Author

    In [1]: import matplotlib
    In [2]: matplotlib.version
    Out[2]: '1.4.0'

  6. modified the milestones: v1.4.1, on Oct 18, 2014
  7. tacaswell commented on Oct 18, 2014

    @tacaswell
    Member

    Thanks for reporting this, this actually is a substantial bug. For some reason, when reading from the file it is growing quotes:

    In [7]: matplotlib.rcParams['lines.marker']
    Out[7]: u"'s'"
    
  8. kfiz commented on Oct 18, 2014

    @kfiz
    Author

    Your welcome. Thanks for the quick response.

  9. 20 remaining items

  10. removed their assignment
    on Oct 2, 2016
  11. story645 commented on Oct 2, 2016

    @story645
    Member

    Sorry, go ahead, totally forgot to follow up. Also what do you mean by machine shop?

  12. self-assigned this
    on Nov 6, 2019
  13. modified the milestones: , needs sorting on Oct 6, 2022
  14. github-actions commented on Oct 9, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  15. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on Oct 9, 2023
  16. story645 commented on Oct 19, 2023

    @story645
    Member

    So uh finally got back to this, and I think it may make more sense to ensure that all the validation functions try to support quoted enteries rather than to document which ones do and don't. That's because, as of now, we have about 47 functions (give or take parameterizations and listifyers) for about 317 rcParams. If there's support, I'd like to repurpose the RcParams project to track work checking each function & follow up prs to add support as needed.

    Basically I'm thinking the work involved is:

    1. choose validation method
    2. find validation test method in test_rcsetup
    3. add a quoted test case
    4. if test case fails, add support for quoted value
    5. alert maintainer to PR so we can add to project & update table
    validator function # rcparams rcParams
    0 validate_bool 71 backend_fallback, interactive, webagg.open_in_browser, lines.antialiased, lines.scale_dashes, pcolormesh.snap, patch.force_edgecolor, patch.antialiased, boxplot.notch, boxplot.vertical, boxplot.patchartist, boxplot.showmeans, boxplot.showcaps, boxplot.showbox, boxplot.showfliers, boxplot.meanline, text.usetex, text.antialiased, text.parse_math, image.resample, image.composite_image, contour.corner_mask, axes.spines.left, axes.spines.right, axes.spines.bottom, axes.spines.top, axes.grid, axes.formatter.use_locale, axes.formatter.use_mathtext, axes.formatter.useoffset, axes.unicode_minus, polaraxes.grid, axes3d.grid, axes3d.automargin, 'date.interval_multiples', legend.fancybox, legend.shadow, legend.frameon, xtick.top, xtick.bottom, xtick.labeltop, xtick.labelbottom, xtick.minor.visible, xtick.minor.top, xtick.minor.bottom, xtick.major.top, xtick.major.bottom, ytick.left, ytick.right, ytick.labelleft, ytick.labelright, ytick.minor.visible, ytick.minor.left, ytick.minor.right, ytick.major.left, ytick.major.right, figure.frameon, figure.autolayout, figure.raise_window, figure.constrained_layout.use, savefig.transparent, tk.window_focus, ps.useafm, pdf.inheritcolor, pdf.use14corefonts, pgf.rcfonts, svg.image_inline, docstring.hardcopy, path.simplify, path.snap, _internal.classic_mode
    1 validate_float 54 lines.linewidth, lines.markeredgewidth, lines.markersize, patch.linewidth, hatch.linewidth, boxplot.flierprops.markeredgewidth, boxplot.flierprops.markersize, boxplot.flierprops.linewidth, boxplot.boxprops.linewidth, boxplot.whiskerprops.linewidth, boxplot.capprops.linewidth, boxplot.medianprops.linewidth, boxplot.meanprops.markersize, boxplot.meanprops.linewidth, font.size, errorbar.capsize, axes.linewidth, axes.titlepad, axes.labelpad, legend.markerscale, legend.borderpad, legend.labelspacing, legend.handlelength, legend.handleheight, legend.handletextpad, legend.borderaxespad, legend.columnspacing, xtick.major.size, xtick.minor.size, xtick.major.width, xtick.minor.width, xtick.major.pad, xtick.minor.pad, ytick.major.size, ytick.minor.size, ytick.major.width, ytick.minor.width, ytick.major.pad, ytick.minor.pad, grid.linewidth, grid.alpha, figure.dpi, figure.subplot.left, figure.subplot.right, figure.subplot.bottom, figure.subplot.top, figure.subplot.wspace, figure.subplot.hspace, figure.constrained_layout.hspace, figure.constrained_layout.wspace, figure.constrained_layout.h_pad, figure.constrained_layout.w_pad, savefig.pad_inches, animation.embed_limit
    2 validate_color 25 lines.color, patch.edgecolor, patch.facecolor, hatch.color, boxplot.flierprops.color, boxplot.flierprops.markeredgecolor, boxplot.boxprops.color, boxplot.whiskerprops.color, boxplot.capprops.color, boxplot.medianprops.color, boxplot.meanprops.color, boxplot.meanprops.markerfacecolor, boxplot.meanprops.markeredgecolor, text.color, axes.facecolor, axes.edgecolor, axes.labelcolor, axes3d.xaxis.panecolor, axes3d.yaxis.panecolor, axes3d.zaxis.panecolor, xtick.color, ytick.color, grid.color, figure.facecolor, figure.edgecolor
    3 validate_stringlist 24 figure.hooks, font.family, font.serif, font.sans-serif, font.cursive, font.fantasy, font.monospace, keymap.fullscreen, keymap.home, keymap.back, keymap.forward, keymap.pan, keymap.zoom, keymap.save, keymap.quit, keymap.quit_all, keymap.grid, keymap.grid_minor, keymap.yscale, keymap.xscale, keymap.help, keymap.copy, animation.ffmpeg_args, animation.convert_args
    4 ValidateInStrings 23 pcolor.shading, text.hinting, mathtext.fontset, mathtext.default, image.origin, contour.algorithm, xaxis.labellocation, yaxis.labellocation, axes.titlelocation, axes.grid.which, axes.grid.axis, axes.autolimit_mode, 'date.converter', xtick.direction, xtick.alignment, ytick.direction, ytick.alignment, macosx.window_mode, 'savefig.orientation', pgf.texsystem, svg.fonttype, animation.html, animation.frame_format
    5 validate_string 22 timezone, webagg.address, lines.marker, boxplot.flierprops.marker, boxplot.meanprops.marker, font.style, font.variant, text.latex.preamble, image.interpolation, scatter.marker, scatter.edgecolors, date.autoformatter.year, date.autoformatter.month, date.autoformatter.day, date.autoformatter.hour, date.autoformatter.minute, date.autoformatter.second, date.autoformatter.microsecond, savefig.format, pgf.preamble, animation.writer, animation.codec
    6 validate_int 14 webagg.port, webagg.port_retries, text.hinting_factor, text.kerning_factor, image.lut, axes.formatter.min_exponent, axes.formatter.offset_threshold, legend.numpoints, legend.scatterpoints, figure.max_open_warning, ps.distiller.res, pdf.compression, agg.path.chunksize, animation.bitrate
    7 _validate_linestyle 9 lines.linestyle, boxplot.flierprops.linestyle, boxplot.boxprops.linestyle, boxplot.whiskerprops.linestyle, boxplot.capprops.linestyle, boxplot.medianprops.linestyle, boxplot.meanprops.linestyle, contour.negative_linestyle, grid.linestyle
    8 validate_fontsize 7 axes.titlesize, axes.labelsize, legend.fontsize, xtick.labelsize, ytick.labelsize, figure.titlesize, figure.labelsize
    9 validate_font_properties 7 mathtext.cal, mathtext.rm, mathtext.tt, mathtext.it, mathtext.bf, mathtext.bfit, mathtext.sf
    10 validate_color_or_auto 6 lines.markerfacecolor, lines.markeredgecolor, boxplot.flierprops.markerfacecolor, axes.titlecolor, 'savefig.facecolor', 'savefig.edgecolor'
    11 validate_fontweight 5 font.weight, axes.titleweight, axes.labelweight, figure.titleweight, figure.labelweight
    12 validate_color_or_inherit 4 legend.facecolor, legend.edgecolor, xtick.labelcolor, ytick.labelcolor
    13 _validate_greaterthan_minushalf 3 axes.xmargin, axes.ymargin, axes.zmargin
    14 _validate_pathlike 3 savefig.directory, animation.ffmpeg_path, animation.convert_path
    15 validate_float_or_None 3 contour.linewidth, axes.titley, legend.framealpha
    16 validate_floatlist 3 lines.dashed_pattern, lines.dashdot_pattern, lines.dotted_pattern
    17 JoinStyle 2 lines.dash_joinstyle, lines.solid_joinstyle
    18 validate_fonttype 2 ps.fonttype, pdf.fonttype
    19 _validate_minor_tick_ndivs 2 xtick.minor.ndivs, ytick.minor.ndivs
    20 CapStyle 2 lines.dash_capstyle, lines.solid_capstyle
    21 validate_int_or_None 1 boxplot.bootstrap
    22 _validate_mathtext_fallback 1 mathtext.fallback
    23 _validate_greaterequal0_lessequal1 1 path.simplify_threshold
    24 validate_anylist 1 path.effects
    25 validate_whiskers 1 boxplot.whiskers
    26 _listify_validator(validate_float, n=2) 1 figure.figsize
    27 _validate_legend_loc 1 legend.loc
    28 validate_dpi 1 'savefig.dpi'
    29 validate_bbox 1 savefig.bbox
    30 _validate_papersize 1 ps.papersize
    31 _validate_cmap 1 image.cmap
    32 validate_axisbelow 1 axes.axisbelow
    33 validate_fillstyle 1 markers.fillstyle
    34 validate_fontstretch 1 font.stretch
    35 validate_fontsize_None 1 legend.title_fontsize
    36 _validate_toolbar 1 toolbar
    37 validate_cycler 1 axes.prop_cycle
    38 validate_hist_bins 1 hist.bins
    39 _listify_validator(validate_int, n=2) 1 axes.formatter.limits
    40 validate_sketch 1 path.sketch
    41 _validate_color_or_linecolor 1 legend.labelcolor
    42 _validate_date 1 date.epoch
    43 validate_backend 1 backend
    44 validate_ps_distiller 1 ps.usedistiller
    45 validate_aspect 1 image.aspect
    46 validate_string_or_None 1 svg.hashsalt
  17. story645 commented on Oct 19, 2023

    @story645
    Member

    Discussed on call and @ksunden pointed out that the everything string approach would create ambiguity for colors, and @QuLogic mentioned @chahak13's work may help in building a directive to improve documentation. The conclusion was that one path forward is to allow '' for the subset of validation functions that take strings where allowing quotes would not create ambiguity.

    Particularly allowing for quotes in the following should handle most use cases:

    • ValidateInStrings
    • validate_stringlist
    • validate_string
  18. timhoffm commented on Oct 20, 2023

    @timhoffm
    Member

    On a side-note: These are the burdens of having a custom file format. Any type-aware format (YAML, TOML, python files, ...) would defer these complications to the format specification/parser and set clear expectations for the user. It would in principle not be difficult do migrate to another format. The major obstacle will be argee on one of them).

  19. story645 commented on Oct 20, 2023

    @story645
    Member

    Any type-aware format (YAML, TOML, python files, ...)

    I went through all the trouble of #26854 & the like six PRs it spawned to avoid Python files 😭
    But also, more seriously, I know we don't use MEPs anymore but I think the .css like approach proposed in MEP 26 would be the most natural transition from what we're already doing to a system that's more flexible and has better type support. I also think MEP 26 can be well scoped if we want to make it a paid project, either GSOC or SDG.

  20. anntzer commented on Nov 15, 2023

    @anntzer
    Contributor

    As I already suggested elsewhere, another possibility would be to keep supporting key: value (for backcompat) but additionally support key = <python literal>, where all strings must be quoted (and where the literal can be parsed with ast.literal_eval), and move all the documentation to recommend the latter. This way there's no ambiguity, and I don't think asking users to quote their strings is overly painful... (plus, they can keep the old format if they want)

  21. timhoffm commented on Nov 15, 2023

    @timhoffm
    Member

    While unambiguous in definition, I'm afraid that'd be still a major source of confusion - users typically don't use this often and it's hard to remember whether it was key: value or key: <python literal>.

    I have a strong preference for any standard format. That way we get rid of all parsing complications, and users don't have to learn a custom syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions