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 8065265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:36:42+00:00 2026-06-05T11:36:42+00:00

I have been currently using a Matlab script that plots a function and prints

  • 0

I have been currently using a Matlab script that plots a function and prints its data into a png file, but I have a problem with this last phase.

The fact is that, moving from plotted image to png files, some data points disappear.
Here are my images.

What Matlab (correctly) plots (note that the maximum is (0; 7.7)):
enter image description here

And here’s what Matlab prints into the file:
enter image description here

Note that all the points in the Y asymptote are missing!

Why does this happen?

Here’s my code:

grafico2D('filename.dat', -1);

...

function [result] = grafico2D(filename, max_X)
% function that loads data from a two-column file and plot them in 2D image
close all;

dati = load(filename); % load data from file
X = dati(:,1); % X axis
Y = dati(:,2); % Y axis

temp = size(X);
lungX = temp(1);

hFig = figure();
set(hFig, 'Visible', 'on');

plot(X, Y, 'red'); 
hold on;
ylim([0 1]); 

if(max_X==-1) 
    xlim([1 X(lungX)]); 
else
    xlim([1 max_X]);
end

xlim

title(strrep(filename,'_','\_')); % substitute _ with \_
xlabel('annotation prediction position'), ylabel('likelihood');
grid


 print(hFig, '-dpng', filename); % stampa su file
% }

result = 1;

end

Is there someone who can help me?
Thanks!

  • 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-05T11:36:45+00:00Added an answer on June 5, 2026 at 11:36 am

    You can increase the resolution of your image with the -r option which specifies the resolution in dot per inch (with 90 as default). It should solve your problem (at least it did for me). See the Matlab print function documentation.

    PS: you could also use thicker lines with the line property LineWidth.

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

Sidebar

Related Questions

Currently, I have been reading lists of data from a binary data file programmatically
In the data structures class that I am currently taking, we have been tasked
I have a R script I'm running now that is currently using 3 correlated
I have been asked to convert an entire site that is currently using wordpress
I'm currently using the following code to scan files that have been uploaded as
I'm currently using the hilo id generator for my classes but have just been
I am currently moving into the web-hosting league. I have to far been adding
I'm currently using os.popen() but have been recommended to use subprocess.popen() instead. Any ideas
I'm currently an undergrad Electrical Engineering student. I've been using MATLab for a while,
Is there a pre-implemented linked list out there that would have been implemented using

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.