Hi,
How to implement/produce a figure like this? I need the code.
Thanks in advance!

5 commentaires

John D'Errico
John D'Errico le 9 Juil 2022
Why is there even a problem? Break a problem that is too large for you down into pieces. You apparently have a set of points. Draw a curve through them. You can use a spline to construct the curve, interpolating it on a denser set of points. Or you can use interp1 to interpolate the points a bit more simply, still plotting the points as well as the interpolated set.
Next, learn to use patch, or perhaps fill if you prefer. You should easily be able to create the necessary 5 sided polygonal patches. Choose the color you want to fill them.
Finally, learn to use a tool like text, which can insert text into a figure.
Make larger problems into small problems. Learn to solve each piece of the puzzle, then put it all together.
Brave A
Brave A le 9 Juil 2022
This not what I need. I need a piece of code to start!
Brave A
Brave A le 9 Juil 2022
Any thoghts?
the cyclist
the cyclist le 9 Juil 2022
I would not necessarily expect a response within a couple hours here, especially on weekends. We are not paid consultants, after all.
Also, I suggest you read this tutorial about how to ask a question well, increasing your chance of getting a satisfactory answer.
John D'Errico
John D'Errico le 9 Juil 2022
If you need a piece of code to start, then start writing. We are not a service where we write code on demand. I gave you pretty clear directions, telling you exactly what tools to use.

Connectez-vous pour commenter.

 Réponse acceptée

Once you invest 2 hours here:
you'll EASILY be able to write very simple code such as these few lines:
t = 2018 : 2025;
data = [23.14, 26.66, 30.73, 35.82, 42.62, 51.11, 62.12, 75.44];
bar(t, data);
hold on;
plot(t, data, 'b.-', 'LineWidth', 2, 'MarkerSize', 20)
grid on
xlabel('Year', 'FontSize', 16);
title('Global IoT Devices', 'FontSize', 16);

3 commentaires

Brave A
Brave A le 10 Juil 2022
Thank you so much! I really appriciated!
But how to show the exact number? since matlab convert the numbers.
t = 2018 : 2025;
data = [23.14, 26.66, 30.73, 35.82, 42.62, 51.11, 62.12, 75.44];
bar(t, data);
hold on;
plot(t, data, 'b.-', 'LineWidth', 2, 'MarkerSize', 20)
grid on
xlabel('Year', 'FontSize', 16);
title('Global IoT Devices', 'FontSize', 16);
text(t, data+10, string(data))
Brave A
Brave A le 10 Juil 2022
Thank you Walter!

Connectez-vous pour commenter.

Plus de réponses (1)

the cyclist
the cyclist le 9 Juil 2022

0 votes

One approach would be find a plot (or plots) in the MATLAB Plot Gallery that look similar to what you want, download that code, and modify the code to get what you want.

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by