how to display images on matplotlib X axis instead of numbers - matplotlib

I have this dendrogram I've generated:
But instead of the 3,2,1,0,4 on the X axis I want to show 5 small .png images.
If this isn't possible can I show a legend where the X axis numbers correspond to an image I can display beside the graph?
Or maybe display the image above the X axis line right above the numbers?

This has been answered multiple times. Please see: Automating bar charts plotting to show country flags as ticklabels
Also, this should probably be a comment, and not an answer, but I don't have enough reputation to post comments.

Related

How to move y axis label further from side of “paper”

I have a data set “mydatainR”
With that I created a barplot and when I download the barplot, part of the y axis is cut off because it’s “off of the paper”
I want to give myself more room to work with, or make my entire bar plot smaller. Thx

Does changing the y-axis and x-axis label changes anything in the image using imshow?

I want to show values as pixels. But my x-axis and y-axis show different range.I don't know what these values are telling us. But I read somewhere that we have to read the values as intensity values. They will not be visualized on the axis. Then what these axis are telling us? Secondly if I use xticks and yticks to label x and y axis does it has any effect on the image? Does it flip anything in the image?
`# a is an array of shape(500,2)
plt.xticks(np.arange(0,2))
plt.yticks(np.arange(0,500))
plt.imshow(a,aspect='auto',cmap=plt.cm.gray)`

Vega / vega-lite multi-level / hierachy axes

i have seen view composition techniques like facets etc.
however i am struggling to create a plot that features multiple view cells / subplots for different combinations of dimensions/groups as seen in the image for the x axis. it should be possible to not only do this for year-month-day but also for something as "country, year" and then plotting e.g. some continuous x vs. y scatter as subplot within individual cell for specific country & year.
could you provide an example json for auch a plot, so that i can have multiple groups applied for both x & y axis?
please see following vega spec for what I've tried already. I would like to add a graph on top of it, the colored boxes should be the scales.
https://vega.github.io/editor/#/url/vega/N4KABGBEAkDODGALApgWwIaQFxUQFzwAdYsB6UgN2QHN0A6agSz0QFcAjOxge1IRQyUa6SgBY6AK1jcAdpAA04KAHdGAExbYwogAw7FESCkbV8WgMx6DUQujVrGM6lv0glkWCZnoANrC0A2koQwFDeqMhakGC29o7O8lAUvqyROK4QmVDsjmpawJCOhKx4UQBO6E6RiZCoji41GAAeWgCM+lCweMiEbQC+YH3WIWHoEeXcrDJ5Nck+qVoAZr6wyDU50-mFMsWlOJBIyPAA1uzcLQNDwWChkOFpSchleIzwvgpJKQ-LfmvZuVsiiUoocTmcLoMlABdRTuNToPCYHBBLKgLKGe5RPBlZDVa6GOapfzI-GZArqKIAQQ+kFsOJkezAMlYPh8sy+Liu6LJhTy+wAQjS6cgGVSaYSHq0udybryogBhIXoemMyDU9nzB46aXc8l8qAAESVKoV4o5OClw3ReqiAFFjSLVYqNQsLX1STDSZBsZVYItuGVUIFSSEQ5lvQBPQgPDw+l6LCMKMOGY7IRP7ClW7m05WOgDSaaiwtFYZ11uTUDwUZjdJeL1kSZl4cWjGQPn1kAljabNjsDicW081G8PiiMT78UgZezZUmmxwBSHI4mUzy0-RHkYAC8HgFF153vsqM9Xr4wAB+MDGUx4MA4VQaRBTxL74eHx4nt4+C9gB8sO9XsgJhmH0UKlh61zuhAnruAgvjIMSYAomSXqYvs8DcD4AbdlkkbRlEAb9u8WZQBUVSDoc4zoQiNABhGABMOhTpB0KwoYGBlMciHIaG2ZVvh+w4vApQkZAiyzkGC6QPCiJYjikTrpAIoYWoDxojKSkMk8+QVmJjCshR8Egph2E1C2bYdhSUEyuuhisIQMlqbp6ayku76dk8Lxfj+MmsKgdBNDoAHXvgAC0vn+RGTG2eGDGDgeo5Hp5p7fpeEUBa0wVATe4UIn5dARq0z66S0UluYlH5eWeaV5ZFQU4OlgVQDFhhNPR8VvhVHmftVEDpYVAGNUV1nciNmRjdZYHukAA
There are a number of faceting examples in the Vega-Lite gallery.

Reportlab LinePlot - how do I add a lineLegend...or label my lines?

I have a lineplot with 2 lines on it...they're two separate channels from the same data set. Would love to just label each one - the "labels" options are all about giving a number for each point on your plot, and that is simply not helpful.
Would love to know how to do any (really, all, but I just need to do one to be happy) of these:
plot each against its own y axis and be able to sensibly label that axis with units (and color the numbers to correspond to the data it correlates to)
put a legend on it. I can't figure out how to use lineLegend
just put any kind of (singular) label in the vicinity of the lines.

Matplotlib:subplots fonts overlap

I want to make 21 subplots using the matplotlib. In some of the plots, fonts of axis are overlapping on the X-axis but X-axis labels are OK. For example, X-axis of one plot has value of (0,10,2) and adjoining plot has value of (0.001,0.010,0.002) so in subplots, 10 (on first X-axis) is overlap with 0.001 (X-axis of adjoining plot). If any one know about it then please reply me.
Many thanks
-Viral
A few things you can try:
Adjust subplots so that there is more wspace and hspace
Adjust xlim/ylim manually to make sure there's no overlap (tricky)
Use tight_layout (see this question)