Label names to each data points in Matlab - matlab

I have a set of data I am analyzing and I would like some help if you can. My data consist of two columns but my X column is only one point and my Y column is about 50 points . So when I plot it of course it's just just diff points along the Y axis versus one single point on the x axis.
Now those points are really closed to each other and what I would like to do is to label each point to their actual Channel name. But so far I tried to use the text() function an it gives me an error saying that my x and y value should be the same. I'm not sure which way to do this anymore. Keep in mind that I have the names of each data points in a file also. Can you help? Keep in mind using one x value and 50 Y values. Lets say I fix it and now the names are on top of each other. Is there a way I am space them out without affecting the location of the points.

Related

Adding x error bars to a scatter plot in tableau

I have a scatter plot in tableau:
I am looking to add error bars to the points but cant find how to do this. I would need to specify the lower limits and upper limmits (i.e. not just a fixed percentage of the value). The only thing I can find is adding y errors in the form of a gant plot but this isnt helpuful (I dont think) as I only need x errors.
Its possible with a combination of using Measure Values (to show lines between the error ranges) and a dual axis (to overlay the X values on the lines)
See sample workbook

Is there a way to increase density of data of scatter data?

I have this x y data:
I would like to increase the density of points by closing small gaps. How do i go about. I still want to preserve the structure of the points.
It depends on what you mean by 'closing gaps'.
if you mean that you want to make the data seem more grouped without actually adding more data points, then you might find the 'LineWidth' argument to be useful. If used currectly it increases the width of each marker in the scatter plot, which will make the data seem more grouped and with less gaps.
to use it, write the scatter code line as follows:
scatter(X, Y, 'LneWidth', width_number)
replace 'width_number' with different values and see the effect.

Overlapping data points and spacing

I have a set of data that I plot but the points on the graphs are so closed to each other that you can't see them well nd neither their values because even when I zoom in I can't get to them all. Now what I want to do is to space them out without changing their actual values on the graph. Is the a function or any other ways to do that? I've tried changing the axis and the scale but it didn't help. Mostly those points are in the Y direction. Please help What I really mean is though these points are closed to each other I'd like to create and interval between them so they don't pile up on each other
You can make the vector you are trying to plot to be more sparse taking points after some defined intervals:
plot(x(1:10:end),y(1:10:end))
In this example, I plotted each tenth point. Does it help?

Core Plot - get data to fill up x axis screen space

My Core Plot is almost finished up but I've noticed an unusual thing I need to change before calling it done. The x axis is scaled properly along the bottom, and the left and right edges indicate the range that I've set. The data, however, is all crushed together on the left side, almost as if the y values are not corresponding to their proper x values.
This image should demonstrate what I mean. You'll notice that the dates run along the bottom, but the actual values don't go past the 6/3/11 mark. They should be all the way to the right.
Link to image
Check the values returned by your datasource. Make sure the x-values are calculated from the same starting date and intervals that you used for the x-axis range and labels.

How does one modify the axes in MATLAB's phylogenetic tree tool?

I want to display pretty dendrograms for some agglomerative clusters I am generating in Java. I write the clusters out to a file in Newick format. Then, I can get a pretty picture that is almost what I want.
tr = phytreeread('myfile.tree')
phytreetool(tr)
Unfortunately, the X axis is not what I want. I would prefer to "reverse" the axis, because the iterations of the clustering progress from right to left, e.g. firstName and setFirstName get clustered in the first iteration. Does anybody know how I can do that, or at least turn off the X axis labeling? (What is the default axis trying to tell me anyway?)
First, you will need to gain access to the handle for the axes in which the dendrogram is plotted. If it's the only figure open, you can use the function FINDALL like so:
phyAxes = findall(0,'Type','axes');
Now, what you want to change isn't the x-axis direction, since this will reverse the plotted dendrogram as well. You actually want to change just the labels used for the x-axis tick marks. If you want to just turn them off, you can do this:
set(phyAxes,'XTick',[]);
Now, I'm not sure what the x-axis is meant to tell you. In your example, it appears that each branch point is positioned at an integer value along the x-axis starting at 0 for the left-most branch point (the "root", I guess). The right-most branch containing firstName and setFirstName is positioned at a value of 21. If you want to change the axis labeling so that the right-most branch is at 0 and the left-most branch is at 21, you can modify the axes as follows:
set(phyAxes,'XTick',0:21,'XTickLabel',num2str((21:-1:0).'));
This could help you?
set(gca,'XDir','reverse')
EDIT
You may find a lot of interesting here. Cheers!
I needed something similar. I don't know if it is new to Matlab R2021b, but there is now a plot(tree) function which will draw the tree on a regular Matlab figure. After plotting, I identify the largest X value and update the XTickLabels.
B = [1 2 ; 3 4];
tree = phytree(B);
h = plot(tree);
ax = h.axes;
xdata = get(findobj(h.axes,'Type','Line'),'XData');
maxdist = max([xdata{:}]);
ax.XTickLabel = num2str(maxdist - str2double(ax.XTickLabel));
Phylogenetic tree with reversed Xtick labels