Chapter 17

Chapter 17

Table of Contents

Data

Download Data for Chapter 17

Alternatively, individual files can be found in the Data section.

Code from chapter

Code for this chapter will appear here.

Solutions to Exercises

Exercise 1

There are no exercises for this chapter. Congratulations on completing the book!

import numpy as np
import plotly.graph_objects as go

theta = np.linspace(0, 2*np.pi, 200)
f_x = np.cos(theta)
f_y = np.sin(theta)

left = (-0.3, 0.4)
right = (0.3, 0.4)

m_theta = np.linspace(0, np.pi, 100)
m_x = 0.5 * np.cos(m_theta)
m_y = -0.4 + 0.2 * -np.sin(m_theta)
m_x = 0.66*np.cos(theta)
m_y = -abs(0.66*np.sin(theta))

fig = go.Figure()

fig.add_scatter(x=f_x, y=f_y, #fill='toself', mode='lines',
            line_color='black', #fillcolor='yellow'
            )

fig.add_scatter(x=[left[0]], y=[left[1]], mode='markers',
            marker=dict(size=20, color='black'))

fig.add_scatter(x=[right[0]], y=[right[1]], mode='markers',
            marker=dict(size=20, color='black'))

fig.add_scatter(x=m_x, y=m_y, mode='lines', line=dict(width=4, color='black'))

fig.update_layout(
title="Congratulations!",
template = "simple_white",
paper_bgcolor='yellow',  
plot_bgcolor='yellow',
xaxis=dict(showgrid=False, zeroline=False, visible=False),
yaxis=dict(showgrid=False, zeroline=False, visible=False),
width=500,
height=500,
margin = dict(l = 40, r = 40, t = 40, b = 40),
showlegend=False
)

fig.update_yaxes(scaleanchor="x", scaleratio=1)
fig.show("png")