Skip to content

TypeError (cycler) when trying to update matplotlib 3.5.2 with the custom styles #550

Open
@andreosokil

Description

@andreosokil

How to solve this issue so the book can be used interactively in Jupyter?
Adding "import cycler" changes nothing, even though I have cycler 0.11.0.
Changing to "colors = ["#348ABD", "#A60628", "#7A68A6", "#467821"]" does not work as well (InvalidSyntax)

import matplotlib

matplotlib.rcParams.update(
    {
        "lines.linewidth": 2.0,
        "axes.edgecolor": "#bcbcbc",
        "patch.linewidth": 0.5,
        "legend.fancybox": True,
        "axes.prop_cycle": cycler('color', [
            "#348ABD",
            "#A60628",
            "#7A68A6",
            "#467821",
            "#CF4457",
            "#188487",
            "#E24A33"
        ]),
        "axes.facecolor": "#eeeeee",
        "axes.labelsize": "large",
        "axes.grid": True,
        "patch.edgecolor": "#eeeeee",
        "axes.titlesize": "x-large",
        "svg.fonttype": "path",
        "examples.directory": ""
    }
)
<img width="606" alt="Знімок екрана 2022-10-25 о 14 12 43" src="https://user-images.githubusercontent.com/116641631/197758488-65619f57-e054-4e4f-bd82-fde902ec976d.png">

Activity

alporter08

alporter08 commented on Nov 27, 2022

@alporter08

I got the same error

frsnjung

frsnjung commented on Feb 6, 2024

@frsnjung

Here is how the code works for me (matplotlib 3.7.4, python 3.8):

import matplotlib
from cycler import cycler
matplotlib.rcParams.update(
{
  "lines.linewidth": 2.0,
  "axes.edgecolor": "#bcbcbc",
  "patch.linewidth": 0.5,
  "legend.fancybox": True,
  "axes.prop_cycle": cycler('color',["#348ABD","#A60628","#7A68A6","#467821","#CF4457","#188487","#E24A33"]),
  "axes.facecolor": "#eeeeee",
  "axes.labelsize": "large",
  "axes.grid": True,
  "patch.edgecolor": "#eeeeee",
  "axes.titlesize": "x-large",
  "svg.fonttype": "path",
  # "examples.directory": ""
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alporter08@frsnjung@andreosokil

        Issue actions

          TypeError (cycler) when trying to update matplotlib 3.5.2 with the custom styles · Issue #550 · CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers