Scatterhistogram y axis squished
古いコメントを表示
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 件のコメント
Adam Danz
2020 年 8 月 28 日
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
2020 年 8 月 28 日
Adam Danz
2020 年 8 月 28 日
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
2020 年 8 月 28 日
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
2020 年 8 月 28 日
Adam Danz
2020 年 8 月 28 日
x(isnan(x)) = 10
AM
2020 年 8 月 28 日
Adam Danz
2020 年 8 月 28 日
This is after you've converted from categorical to numeric, right?
AM
2020 年 8 月 28 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
