Increasing the size of a plot

Hello,

I am trying to increase the size of my plot so it can be better seen. Please
how would I do this ? All I want to do is to make it bigger.

Thanks,

“”"
FEniCS tutorial demo program: Diffusion of a Gaussian hill.

u’= Laplace(u) + f in a square domain
u = u_D on the boundary
u = u_0 at t = 0

u_D = f = 0

The initial condition u_0 is chosen as a Gaussian hill.
“”"

from dolfin import *
from mshr import *
from fenics import *
import time

T = 2.0 # final time
num_steps = 50 # number of time steps
dt = T / num_steps # time step size

#Making a cylindrical geometry 10 cm radius and 15 cm height in S.I

cylinder = Cylinder(Point(0, 0, -7.5), Point(0, 0, 7.5), 5, 5)
domain = cylinder

Making Mesh ( THe value corresponds to the mesh density)

mesh = generate_mesh(domain, 15) # generates 3D model of the cylindrical geometry in x, y, and z axes.
V = FunctionSpace(mesh, ‘P’, 1)

Plot the mesh.

#plot(mesh, title = ‘Cyliner heat explicit Mesh’)
#filename = ‘heat_explicit_mesh.png’
#plt.savefig ( filename )
#print ( ’ Graphics saved as “%s”’ % ( filename ) )

Define boundary condition

def boundary(x, on_boundary):
return on_boundary

( not sure what this really represents )

bc = DirichletBC(V, Constant(0), boundary)

Definining the intial temperature. 300 K

u_0 = Constant(‘300’)
a = 5

Expression(‘300’, degree=2, a=5)

u_n = interpolate(u_0, V)

Define variational problem

u = TrialFunction(V)
v = TestFunction(V)
f = Constant(0)

( not sure what this really represents ) turn the F function as time dependent function

F = uvdx + dt*dot(grad(u), grad(v))dx - (u_n + dtf)vdx
a, L = lhs(F), rhs(F)

Create VTK file for saving solution

vtkfile = File(‘heat_gaussian/solution.pvd’)

Time-stepping

u = Function(V)
t = 0
for n in range(num_steps):

# Update current time
t += dt

# Compute solution
solve(a == L, u, bc)

# Save to file and plot solution
vtkfile << (u, t)
plot(u)

# Update previous solution
u_n.assign(u)

import matplotlib.pyplot as plt
plt.show()

Create a matplotlib.pyplot.figure and then manipulate the axis object as you like:

import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8,8))
ax = fig.gca()
plot(u)

For vtk-based contour plots, I would recommend @marcomusy’s vedo

2 Likes