D
D
Drak Lowell2020-07-02 13:27:42
Python
Drak Lowell, 2020-07-02 13:27:42

How to plot a specific plot in python matlab?

You need to make a graph, with a division in the middle into parts of different colors. An example in the photo. You need to specify the percentage of black and blue parts, as well as the height5efdb67d769d6649457076.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dmshar, 2020-07-02
@felopil

Firstly, the "PYTHON", "MATLAB" tags are, as it were, different tools. And the ways of drawing in them are somewhat different. You need to draw in both systems at once - then I don’t know,
And if only in Python, then something like this:

import numpy as np
import matplotlib.pyplot as plt
x=np.linspace( -2*np.pi,2*np.pi,100)
y1=1/(1+x**2)
y2=np.cos(x)**2
y3=np.exp( -x**2/10)
z=2*(y1+y2+y3)
plt.stackplot(x,y1,y2,y3)
plt.plot(x,z,'k', linewidth=4)
plt.xlim( -2*np.pi , 2*np.pi)
plt.grid(True)

The result is in the picture. 5efdfa2138537958972806.png
"At the same time, it is necessary to indicate the percentage of the black and blue parts, as well as the height" - what does "indicate" mean? And what does "height" mean? What and how you additionally indicate on your chart depends only on what additional commands you set.

A
Andy_U, 2020-07-02
@Andy_U

I saw something similar in the official matplotlib documentation. Search better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question