How to change X and Y axis numbers' colour in GraphView for Android? - android-graphview

I'm using GraphView in my app to display a realtime graph from the magnetic field sensor values.
Initialized the GraphView object as follows:
GraphView graph = findViewById(R.id.graph);
...
and set data series and grid colour using the following:
...
graph.addSeries(series);
...
graph.getGridLabelRenderer().setGridColor(Color.RED);
And I get this as a result.
Graph with numbers I want to change highlited
Now I want to remove the X and Y axis value numbers indicated in the above picture by green arrows, how can I do that? If they can't be removed, how can I change their font colour? I'll make it match the background.

Just found what I was looking for, to disable the X and Y numbers along the axes, use:
graph.getGridLabelRenderer().setVerticalLabelsVisible(false);
graph.getGridLabelRenderer().setHorizontalLabelsVisible(false);

Related

Add labels for x and y using the plotmatrix function MATLAB

I managed to plot a matrix (16X16) but I want to add labels for each single x and y axis's. As shown below, the labels are written vertically on the y and mixed with each other and also written on the x graph itself and also mixed. Is there a way to add the labels beside the axis without being mixed (as show in the second photo)?
Current graph:
What I want to do:
My code (just stopped after plotting three label as it wasn't working):
[~,ax] = plotmatrix(corr);
ylabel(ax(1,1),'ABCDEFGHIJKLMNOP')
ylabel(ax(2,1),'ABCDEFGHIJKLMNOP')
ylabel(ax(3,1),'ABCDEFGHIJKLMNOP')
xlabel(ax(16,1),'ABCDEFGHIJKLMNOP')
xlabel(ax(16,2),'ABCDEFGHIJKLMNOP')
xlabel(ax(16,3),'ABCDEFGHIJKLMNOP')
If I understand your problem you want to be able to give individual y-labels for the rows and x-labels for the columns. Unfortunately when you use xlabel and ylabel the resulting text overlaps. Here are two solutions
Solution 1: Use the big-axes to set the labels
Use single label for the horizontal axis and vertical axis by referencing the big-axes
[~,~,HBigAxe] = plotmatrix(corr);
xlabel(HBigAxe,'Horizontal Label for Columns');
ylabel(HBigAxe,'Vertical Label for Rows');
Solution 2: use rotation and alignment to avoid overlapping labels
If you want each row and column to have there own labels you can rotate and set the horizontal alignment of the label. For example:
[~,ax] = plotmatrix(corr);
ylabel(ax(1,1),'Y Axis Label','Rotation',0,'HorizontalAlignment','right')
xlabel(ax(end,1),'X Axis Label','Rotation',90,'HorizontalAlignment','right')

Google Image chart not showing correct value for Y-axis in Bar chart

I am rending image chart on a server side code. I am using bar chart (bvg).
I am not able to render the chart the way I want to. I am sure it's doable because I have done it using Google Chart JS. The chart's x axis is month and y axis is score. I want to display the labels Month and Score for each axis along with the bar labels. I also want to show the value markers on the Y-axis.
When I add X and Y axis labels with chxl the Axis Labels shows up along with Y-axis value markers; but strange the value markers denote wrong values. The values range between 0 and 100 no matter what values my bar represents and that too the height of the bar doesn't match with the Y-axis values (which ranges between 0 and 100). Please help.
I've written the URL like this:
https://chart.googleapis.com/chart?cht=bvg&chxt=x,x,y,y&chxl=1:|Months|3:|Score&chxp=1,50|3,50&chbh=30,20,20&chds=0,40&chs=400x400&chco=015CAE,015CAE,015CAE,015CAE,015CAE&chd=t:22,32,11,27,8&chl=Jan|Feb|Mar|Apr|May
And I am concerned about the values displayed in the following snapshot of the chart (see highlighted values in red, they do not match the actual bar values):
Don't Include chds parameter
Here is the modified link:
https://chart.googleapis.com/chart?cht=bvg&chxt=x,x,y,y&chxl=1:|Months|3:|Score&chxp=1,50|3,50&chbh=30,20,20&chs=400x400&chco=015CAE,015CAE,015CAE,015CAE,015CAE&chd=t:22,32,11,27,8&chl=Jan|Feb|Mar|Apr|May

Visualizing 1D data in MATLAB

I have a vector which gives the speed of a rat over time. Could someone please help me on how I can show this data with a "color map" or "color bar". Basically I want to show each data point with a color.
As what Suever suggested, using imagesc is perfectly fine for your purposes. You can also add in a colour bar to give meaning of the mapped colours to the values in your vector. The y-axis won't have any meaning as you'll want to concentrate on the colours themselves. Therefore, you'll want to blank out the y-axis by grabbing a handle to the current axes in the plot and just setting the y-axis labels to blank.
As such, do something like this assuming that your data is stored in the vector data:
data = rand(1,100); %// random dummy data - 100 element vector
imagesc(data);
colorbar;
set(gca, 'YTick', []);
We get this image now:
Note that the colour bar on the right is scaled using the lowest and highest values in your data. The colours will be scaled so that it conforms to this lowest and highest value.

Is there any way to change the xy positions in scatter graph in core plot

I am creating scatter graph, I need to change the x and y positions in scatter graph. Graph always starts with (0,0) positions but i need to show the starting points (7000, 800). Is there any way to change the x and y positions in scatter graph in core plot.
After showing the graph need to draw the line manually and get those values to search the properties.
Please help me.
Thanks in advance.
to set the point where the co-ordinates meet you have to set the orthogonal co-ordinate decimal
x.orthogonalCoordinateDecimal = CPTDecimalFromString(#"800");
y.orthogonalCoordinateDecimal = CPTDecimalFromString(#"740000");
and for setting the range of values to be plotted set the visibleRange for both the axes
These are features of the "plot space" in Core Plot. It defines the coordinate mapping between the plot area (basically the rectangle that contains all plot drawing) in data coordinates and the view in drawing coordinates. The xRange and yRange control the x and y range of the plot space, respectively.
The plot space converts coordinates in both directions—from data to view when drawing and from view to data when (for example) responding to touch events on a plot. See the plot space docs for a list of the available coordinate conversion methods.

How do I plot data labels alongside my data in a bar graph

I have a bar graph in which i would like to plot data labels alongside my data points. I have looked at this documentation and they don't seem to have what i need. This is all done using MATLAB.
Below is an example of what i'd like, although for a bar graph instead of a scatter plot.
Use TEXT function to label the bars. STRCAT function can be used to create custom labels.
x = (1:5)';
y = rand(5,1);
bar(x,y)
%# show X and Y coordinates
text(x,y,strcat('(',num2str(x),',',num2str(y,2),')'),...
'horiz','center','vert','bottom')
You can also add some small gap to y coordinates to make text a little higher.
Use the code below and customize in your case.
for ii = 1:numel(X)
text(X(ii)+.02, Y(ii)+.02,textCell{ii},'FontSize',8)
end