TransWikia.com

Why my current figure replace with previous one after using this code?

TeX - LaTeX Asked by Md. Asif Iqbal Fahim on June 12, 2021

After using this code again for another figure, my recent figure replace with the previous one! Why did this happen? I used IEEEtran.bst format. Please help. Thanks in an advance.

This figure not shown yet.

      begin{figure}[h]
    begin{center}
    includegraphics[height=8 cm,width=.9textwidth, center]{Logos/figures/dataset_distribution.png}
    end{center}
    caption{Three class distribution of our dataset.}
    end{figure}

This figure show but replace the previous one.

  begin{figure}[h]
    begin{center}
    includegraphics[height=8 cm,width=.9textwidth, center]{Logos/figures/dataset_pics.png}
    end{center}
    caption{Some of the dataset's images with labels}
    end{figure}

enter image description here

One Answer

To long for the comment:

We ask you for complete small document, which reproduce your problem. Such document is here named as Minimal Working Example (MWE). An example of MWE with containing your (corrected) code fragments is:

documentclass{article}
usepackage{graphicx}

begin{document}
begin{figure}[ht]
centering
includegraphics[height=6cm,width=.9textwidth]{example-image-a}
caption{Three class distribution of our dataset.}
label{fig:distribution}
end{figure}
    
begin{figure}[ht]
centering
includegraphics[height=6cm,width=.9textwidth]{example-image-b}
caption{Some of the dataset's images with labels}
label{fig:imageset}
end{figure}
As you can see, figure ref{fig:imageset} is not equal to figure ref{fig:distribution}!
end{document}

which produce:

enter image description here

As you can see, images are different. This means, that the cause of your problem are not in provided code fragments. Please check if the image file dataset_pics contain the same picture as file dataset_distribution. If they are different, please provide MWE which will reproduce your problem.

Note:

  • Your code fragments use undefined option center which cause error, so remove them (as is done in my MWE).
  • Use center environment introduce additional vertical space, therefore is better to use command centering (see MWE).
  • I reduce image height that they can appear on the same page.
  • you not need to declare image file name extension (.png).

Correct answer by Zarko on June 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP