Many of axis labels - axis

Could somebody help mi with http://www.jqplot.com/tests/axisLabelTests.php
I need to insert three axis on picture but I don't know how.

You can find examples of what you want in the following links [jqPlot documentation] :
- First example
- Second example
And finally, Axis documentation here
Edit According to your comment attached to your original post, you can do something like this (jsFiddle link) :
//Declare a first series
var cosPoints = [...];
//Declare a second one
var cosPoints2 = [...];
//Draw a new plot with those two series
$.jqplot('chart1', [cosPoints,cosPoints2], {});
//You will obtain a graph with two lines representing your two series.
PS I think you definitely need to take a look at jqPlot examples here and here

Related

Alter tick labels to a '10^ - style' appearance

Though there are quite a lot of answered questions to that kind of issue, I wasn’t able to find a proper solution for my exact problem. Anyway.
I try to format my tick lables like shown in the following example:
I already found out that the ‘sprintf’ command is offering a possibility to alter the tick format. The closest I came to what I want is the 'e-notation' triggered by the following command:
set(ax,'YTickLabel',sprintf('%2.0e|',yticks))
However, I’d like my labels to appear just as shown in the example picture. Is there a simple way to do that?
Thank you very much in advance,
Joe
You could use Latex formatting and sprintfc to produce what you want. (You might not need sprintfc at all actually but that's a nice way of creating a cell array of strings with numbers in a single line.):
set(ax,'YTickLabels',sprintfc('10^{%i}',yticks)
In a general example (here with x-axis formatted):
clear
clc
close all
x = 0:100000;
y = log(x);
figure
semilogx(x,y)
xt = get(gca,'XTick');
set(gca,'XTickLabels',sprintfc('10^{%i}',0:numel(xt)-1))
outputs the following:
Am I missing something? Why not use semilogy?
x = -3:0;
y = 10.^x;
semilogy(x, y);
set(gca, 'YMinorGrid', 'on')

Change markers in dynamic plots

What I have:
hold on
for i =1:length(tspan)
var{i} = Tv(:,i);
str{i} = ['t = ',num2str(tspan(i)), ' s'];
plot(z,var{i},'DisplayName',str{i});
end
legend('-DynamicLegend');
This works perfectly (thanks to this), but it prints out all blue lines.
I tried to set up a colormap (the default) and use it like this, but the output was the same
plot(z,var{i},'DisplayName',str{i},'Color', colormap(i,:));
And I would also like to see different markers for each plot. How is it possible to change them?
EDIT
Thanks to ironzionlion I fixed the colors. How can I do the same with markers?
According to the post that you mention, you have to define that you will need i different colours in your plot. This can be done by using colors = hsv(i)
Your plot sentence will then be: plot(z,var{i},'DisplayName',str{i},'Color', colors(i,:));
Update
I am not aware of the existance of "markermap". You could fix the problem just by define upfront the different markers that you want (quick and dirty solution): mrk={'o','+','*','.'};
Then you will plot by selecting each time the corresponding marker:
plot(z,var{i},'DisplayName',str{i},'Color', cmap(i,:),'Marker', mrk{i});

plotyy function showing two x-axes but only want one

I am using the plotyy function to produce the chart in the image below.
I have two issues with this chart. First issue being having two x-axes I want the zero on the left hand side of my chart to be level with the zero on the right hand side. Is there anyway I can make this happen?
Lastly I want to put some labels on the x-axis however you can that I labels have numbers on top of them. I only want the labels to be visible which I cannot seem to do?
Below is my code.
x_labels = data_cell(2:end, 1);
risk_tot = cell2mat(data_cell(2:end, 2));
risk_cont = cell2mat(data_cell(2:end, 3));
[pp,h1,h2]=plotyy((1:length(risk_tot)),risk_tot,(1:length(risk_tot)),risk_cont,'bar','stem');
set(gca,'XtickL',x_labels);
set(h1,'FaceColor',my_Blue2(40,:),'EdgeColor',my_Blue2(40,:))
set(h2,'Color',my_Orange(1,:),'LineWidth',0.5,'MarkerEdgeColor',my_Orange(1,:))
set(pp(1),'Box','off')
set(pp(2),'Box','off')
Update
I have managed to resolve the second issue with the x-axis labels. I simply added the line below. This sets the second x-axis labels to empty.
Still can't fix the first issue.
set(pp(2),'XTickLabel',[]);
Try linkaxes:
linkaxes(pp,'y')
You may need to adjust the axes limits with pp(1).Ylim = ... to get the desired result.

How do I detect an instance of an object in an image?

I have an image containing several specific objects. I would like to detect the positions of those objects in this image. To do that I have some model images containing the objects I would like to detect. These images are well cropped around the object instance I want to detect.
Here is an example:
In this big image,
I would like to detect the object represented in this model image:
Since you originally posted this as a 'gimme-da-codez' question, showing absolutely no effort, I'm not going to give you the code. I will describe the approach in general terms, with hints along the way and it's up to you to figure out the exact code to do it.
Firstly, if you have a template, a larger image, and you want to find instances of that template in the image, always think of cross-correlation. The theory is the same whether you're processing 1D signals (called a matched filter in signal processing) or 2D images.
Cross-correlating an image with a known template gives you a peak wherever the template is an exact match. Look up the function normxcorr2 and understand the example in the documentation.
Once you find the peak, you'll have to account for the offset from the actual location in the original image. The offset is related to the fact that cross-correlating an N point signal with an M point signal results in an N + M -1 point output. This should be clear once you read up on cross-correlation, but you should also look at the example in the doc I mentioned above to get an idea.
Once you do these two, then the rest is trivial and just involves cosmetic dressing up of your result. Here's my result after detecting the object following the above.
Here's a few code hints to get you going. Fill in the rest wherever I have ...
%#read & convert the image
imgCol = imread('http://i.stack.imgur.com/tbnV9.jpg');
imgGray = rgb2gray(img);
obj = rgb2gray(imread('http://i.stack.imgur.com/GkYii.jpg'));
%# cross-correlate and find the offset
corr = normxcorr2(...);
[~,indx] = max(abs(corr(:))); %# Modify for multiple instances (generalize)
[yPeak, xPeak] = ind2sub(...);
corrOffset = [yPeak - ..., xPeak - ...];
%# create a mask
mask = zeros(size(...));
mask(...) = 1;
mask = imdilate(mask,ones(size(...)));
%# plot the above result
h1 = imshow(imgGray);
set(h1,'AlphaData',0.4)
hold on
h2 = imshow(imgCol);
set(h2,'AlphaData',mask)
Here is the answer that I was about to post when the question was closed. I guess it's similar to yoda's answer.
You can try to use normalized cross corelation:
im=rgb2gray(imread('di-5Y01.jpg'));
imObj=rgb2gray(imread('di-FNMJ.jpg'));
score = normxcorr2(imObj,im);
imagesc(score)
The result is: (As you can see, the whitest point corresponds to the position of your object.)
The Mathworks has a classic demo of image registration using the same technique as in #yoda's answer:
Registering an Image Using Normalized Cross-Correlation

AChartEngine graph using two y axis

I am currently trying to create a graph using AChartEngine containing two y-axis (one to the left, one to the right). Yet, I cannot seem to figure out how I can actually add the second y-Axis. An XYMultipleSeriesRenderer only has got one setYTitle() method.
Has someone ever achieved this and can give me a hint?
Thanks,
Matthias
You can do that, indeed. Please see an example for this here.
The result looks like
.