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 9246211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:26:34+00:00 2026-06-18T09:26:34+00:00

I am using python and matplotlib to generate graphical output. Is there a simple

  • 0

I am using python and matplotlib to generate graphical output.
Is there a simple way to generate a dash-dot-dot line-style?
I am aware of the '--', '-.', and ':' options. Unfortunately, '-..' does not result in a dash-dot-dot line.
I have looked at the set_dashes command, but that seems to control the length of the dashes and the space between two adjacent dashes.
One option may be to plot two lines on top of each other; one dashed with ample space between the dashes – and one dotted, with the dots as large as the dashes are wide and spaced so that two dots are in between each of the dashes. I do not doubt this can be done, I am simply hoping for an easier way.
Did I overlook an option?

  • 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-06-18T09:26:35+00:00Added an answer on June 18, 2026 at 9:26 am

    You can define custom dashes:

    import matplotlib.pyplot as plt
    
    line, = plt.plot([1,5,2,4], '-')
    line.set_dashes([8, 4, 2, 4, 2, 4]) 
    plt.show()
    

    enter image description here

    [8, 4, 2, 4, 2, 4] means

    • 8 points on, (dash)
    • 4 points off,
    • 2 points on, (dot)
    • 4 points off,
    • 2 points on, (dot)
    • 4 points off.

    @Achim noted you can also specify the dashes parameter:

    plt.plot([1,5,2,4], '-', dashes=[8, 4, 2, 4, 2, 4])
    plt.show()
    

    produces the same result shown above.

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

Sidebar

Related Questions

I'm using python and matplotlib to generate graphical output. I am creating multiple plots
I want to generate high-quality diagrams for a presentation. I’m using Python’s matplotlib to
I have a python script that can output a plot using matplotlib and command
I am using Python matplotlib. i want to superimpose scatter plots. I know how
I am trying to plot two columns from a text file using python matplotlib
I'm using Python with Matplotlib for drawing. I have two matrices (images in levels
I'm plotting data in Python using matplotlib. I am updating the data of the
I'm using matplotlib and Python 2.7 I have a MxN matrix of tuples, an
I am trying to plot data sets U(x,t) and V(x,t) using Python's matplotlib.pyplot subplots.
I need to plot a stem plot of my signal using python and matplotlib.

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.