Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6911045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:54:01+00:00 2026-05-27T08:54:01+00:00

Whenever, I want to plot multiple 2d line graphs graphs with matplotlib, I define

  • 0

Whenever, I want to plot multiple 2d line graphs graphs with matplotlib, I define two lists :

coloTypesList=["b","g","r","c","m","y","k"];
drawTypesList=["-","--","x"];

and select a pair from these at each iteration(for each graph). This is method only helps me when I have less than 22 graphs to draw. Any idea about making this more general with the coloring and the drawing-type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:54:02+00:00Added an answer on May 27, 2026 at 8:54 am

    From the lists you give you have 21 combinations:

    >>> from itertools import product
    >>> markers = ["-", "--", "x"]
    >>> colors = ["b", "g", "r", "c", "m", "y", "k"]
    >>> [a + b for a, b in product(colors, markers)]
    ['b-', 'b--', 'bx', 'g-', 'g--', 'gx', 'r-', 'r--', 'rx', 'c-', 'c--', 'cx', 'm-', 'm--', 'mx', 'y-', 'y--', 'yx', 'k-', 'k--', 'kx']
    

    However there are many more options than those you currently use:

    Line style or marker:

    ================    ===============================
    character           description
    ================    ===============================
    ``'-'``             solid line style
    ``'--'``            dashed line style
    ``'-.'``            dash-dot line style
    ``':'``             dotted line style
    ``'.'``             point marker
    ``','``             pixel marker
    ``'o'``             circle marker
    ``'v'``             triangle_down marker
    ``'^'``             triangle_up marker
    ``'<'``             triangle_left marker
    ``'>'``             triangle_right marker
    ``'1'``             tri_down marker
    ``'2'``             tri_up marker
    ``'3'``             tri_left marker
    ``'4'``             tri_right marker
    ``'s'``             square marker
    ``'p'``             pentagon marker
    ``'*'``             star marker
    ``'h'``             hexagon1 marker
    ``'H'``             hexagon2 marker
    ``'+'``             plus marker
    ``'x'``             x marker
    ``'D'``             diamond marker
    ``'d'``             thin_diamond marker
    ``'|'``             vline marker
    ``'_'``             hline marker
    ================    ===============================
    

    Color abbreviations:

    ==========  ========
    character   color
    ==========  ========
    'b'         blue
    'g'         green
    'r'         red
    'c'         cyan
    'm'         magenta
    'y'         yellow
    'k'         black
    'w'         white
    ==========  ========
    

    Note that you can specify colors as RGB or RGBA tuples ((0, 1, 0, 1)) so you can create a full palette. Just adding light/dark versions of your current colors you are multiplying your possibilities.

    I’m not sure you need so many combinations of markers and colors in one only plot. Given you use only the standard colors, you have a maximum of 26 * 8 = 208 combinations (well, white should not be taken into account…).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I want to modify a winform from another thread, I need to use
Currently in MVC, we have to define columns manually whenever we want to list
Whenever I want to add a comment to an indented line in vim, I
i'm using the DOMdocument class in php whenever i want to create a XML
When debugging, a trick I do whenever I want to exit the current method
I want my JTextPane to insert spaces whenever I press Tab. Currently it inserts
I want my web page to beep whenever a user exceeds the maximum character
I want code to run whenever I create a new object. For example, see
I want to send a message whenever RabbitMQ creates or deletes a queue, exchange
I want to get Default Windows Forms Unhandled-Exception Dialog whenever my C# application encounters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.