Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 How to superscript figures? Felipe Silly Frenchman Posts: 44 Threads: 17 Joined: Jan 2017 Reputation: 0 Likes received: 2 #1 Feb-06-2017, 05:56 PM Hi all, I wrote a function which plots rectangles filled or not. If I use flag == 0 I want rectangles filled, in case of flag == 1 I want only the contour of the rectangles. Here's my function: ```#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt import matplotlib #from matplotlib.patches import Polygon #from matplotlib.collections import PatchCollection def tabular(X,dx,p,prism,flag):     vm=3*max(p[:,4])     fig = plt.figure()     ax = fig.add_subplot(111)         for i in range(prism):         xl = (p[i,2]-p[i,3]/2)                  cor='red'         if p[i,1] < 0:             cor='blue'         if flag == 0:             rect = matplotlib.patches.Rectangle((xl,p[i,4]), p[i,3], vm-p[i,4], color=cor)             ax.add_patch(rect)             plt.xlim(X, X[-1])             plt.ylim([0, vm])             ax = plt.gca()             ax.invert_yaxis()         elif flag == 1:             rect = matplotlib.patches.Rectangle((xl,p[i,4]), p[i,3], vm-p[i,4], linestyle = '--', fill = False)             ax.add_patch(rect)             plt.xlim(X, X[-1])             plt.ylim([0, vm])             ax = plt.gca()             ax.invert_yaxis()     plt.title('Disposição de Prismas')     plt.xlabel('Posição(m)')     plt.ylabel('Profundidade (m)')     plt.show()     return ```The function works well. But, I want to call it two times. In the first one, I need to plot color rectangles. In the second one, I want to change the arguments and plot the results, only with the contour, in the same figure. The final result needs to be a single figure with colorful and contour rectangles. A superscription similar to the function 'hold on' from Matlab is that what I want. At this moment my code produces two figures as you can see below, but the perfect result is the combination of both:  « Next Oldest | Next Newest »

Top Page

 Possibly Related Threads... Thread Author Replies Views Last Post Superimpose figures Scientifix 2 1,841 Aug-16-2019, 04:06 PM Last Post: Nitram

Forum Jump:

Users browsing this thread: 1 Guest(s)