Python Trying to plot parametrized linestlyes - Implementation problem

  • Thread starter Thread starter Arman777
  • Start date Start date
  • Tags Tags
    Plot
Click For Summary
The discussion revolves around the challenge of implementing parametrized linestyles in a Matplotlib plot. The user seeks guidance on how to modify their existing code to incorporate these linestyles, specifically referencing a Matplotlib gallery page for examples. A sample code snippet is provided, which plots a quadratic function with a basic linestyle. Respondents emphasize that the information needed to resolve the issue is available on the referenced website, suggesting that the user should review the examples there to understand the necessary adjustments for their code.
Arman777
Insights Author
Gold Member
Messages
2,163
Reaction score
191
I am have couple of datas and when I plot them I am running out of linestyles. I have found couple of **parametrized linestyles** in this site, but somehow I cannot implement them.

https://matplotlib.org/3.3.1/gallery/lines_bars_and_markers/linestyles.html

Can someone show me what should I do put in this line of code to obtain those linestyles?

plt.plot(x, y, color = "magenta", linestyle = "-")

here is a sample code


Python:
 import matplotlib.pyplot as plt
    from numpy import linspace

    x = linspace(0, 10, 100)
    y = x**2

    plt.plot(x, y, color = "magenta", linestyle = "-")
    plt.grid()
    plt.show()
 
Last edited:
Technology news on Phys.org
Arman777 said:
Can someone show me what should I do put in this line of code to obtain those

Sure, here is an example of what you have to do to get these linestyles:
https://matplotlib.org/3.3.1/gallery/lines_bars_and_markers/linestyles.html

Seriously though, the code on that website shows exactly what you are missing in your code. Have you actually looked at it and tried it?
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 21 ·
Replies
21
Views
5K
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 14 ·
Replies
14
Views
6K