Scatterhistogram y axis squished
Mostrar comentarios más antiguos
Hello, I am trying to plot data on a scatterhistogram, figure attached. The y axis comes out squished - as it goes up to 350 while the data peaks at 100. I can't figure out how to limit it to 100 instead of 350. I succeeded in getting a popup in the live editor which allowed me to delete ticks from the y axis, but I can't find it again and I didn't copy the code. Thank you for your help.

10 comentarios
Adam Danz
el 28 de Ag. de 2020
Please provide a minimal working example that reproduces the problem.
The y axis labels look suspicious to me and the main axis is typically set to "tight" which would greately reduce your y-axis limits so something seems off and it may be user error.
AM
el 28 de Ag. de 2020
Adam Danz
el 28 de Ag. de 2020
No problem. You've come to the right place!
A minimal working example is a short, concise block of code that we can copy/paste in order to reproduce the problem in our end. Sometimes that may require attaching a data file or including a few lines of code of "fake data". The points it to provide something that we can very simply copy/paste and immediately see the problem.
AM
el 28 de Ag. de 2020
The y axis is as expected when I run your code. Are you sure you're not making any adjustments after the plot is produced?
Two things I noticed:
- age_date.weekly_cases is categorical and it's plotted along the y axis. This is why you have so many y-tick labels. Since the categories are numeric, you probably want to convert those values to numbers. The plot would make more sense and it would look a lot better.
- One of the categories is "<15". If you take my advices in the first point above, you'll need to convert this category to some number (14?). The row of dots at the top of the plot below are data for this category and they will then appear at y=14 (or whatever value you choose). You can then indicate with text that this value is actually <=14.
Lastly, avoid using the variable name "scatter" since that's a commonly used Matlab function name.

AM
el 28 de Ag. de 2020
Adam Danz
el 28 de Ag. de 2020
x(isnan(x)) = 10
AM
el 28 de Ag. de 2020
Adam Danz
el 28 de Ag. de 2020
This is after you've converted from categorical to numeric, right?
AM
el 28 de Ag. de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
