Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:55:16+00:00 2026-06-08T15:55:16+00:00

I have two financial graphics and I need to analyze how them perform comparing

  • 0

I have two financial graphics and I need to analyze how them perform comparing to each other. I wrote such program:

clear

fLog = fopen('log.log');
data = textscan(fLog, '%f:%f:%f:%f %f %f %f');
fclose(fLog);

% hh:min:sec:millisec
secvec = [60*60 60 1 1e-3];
x = [data{1:4}] * secvec';

y = data{5};
yPrice = data{6};

xindays = x / (24*60*60);

plot(xindays, y);
hold on
plot(xindays, yPrice);

ticklabelformat(gca,'y','%g')
ticklabelformat(gca,'x',{@tick2datestr,'x','HH:MM:SS'})

log.log file example

The problem is that as two graphics has completely different “Y” value them both looks like “straight” line. So I need somehow to have two Y axis, probably one on the left and one on the right, but they should has the same scale, meaning 1% change should be the same on both graphics so I should be able to compare which stock outperforms and where. If it is possible to do that and how?

I also want to draw this graphics using different colors but I likely can google myself how to do that once above problem is resolved.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:55:21+00:00Added an answer on June 8, 2026 at 3:55 pm

    You’re looking for plotyy. Because you also change the xticks, I advise to remove the xticks from one of the two resulting axes, otherwise they’ll overlap:

    [AX,H1,H2] = plotyy(xindays,y,xindays,yPrice);
    set(AX(1),'xtick',[])
    
    ticklabelformat(AX(2),'y','%g')
    ticklabelformat(AX(2),'x',{@tick2datestr,'x','HH:MM:SS'})
    

    This gives you the following figure:

    enter image description here

    EDIT:

    As you can see, plotyy just makes sure that all data is in the visible window. So the y-axis scalings are not equal. If you really want that, you can always change that after using plotyy. eg:

    [AX,H1,H2] = plotyy(xindays,y,xindays,yPrice);
    set(AX(1),'xtick',[]);
    
    ylim(AX(1),[<lower bound>   <upper bound>]);
    ylim(AX(2),[<lower bound>   <upper bound>]);
    
    ticklabelformat(AX(2),'y','%g')
    ticklabelformat(AX(2),'x',{@tick2datestr,'x','HH:MM:SS'})
    

    The ideal visible ranges depend on the range of the data itself, so you’ll have to fix this yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to compare two row with each other and then write the fields
Have two variables both containing integers: var input; var value; Need to perform arithmetic
I have two pictures on top of each other: Here is the code: <div
I have a (C#) genetic program that uses financial time-series data and it's currently
Have two sets of data (two tables) for patient records, one 1999-2003, the other
We have two servers in the same network. One of them is the server
I have two databases I need to work with, one oracle on a remote
I have two files from a C program. I guess both belong to quite
If I have those two projects: MyCompany.ERP.Billing MyCompany.ERP.Financial Billing asks/sends information to Financial and
Have two UIBarButtonItems want to make it as one UIBarButtonItem and toggle between them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.