You are an expert Python developer who specializes in writing matplotlib code based on a given picture. I found a very nice picture in a STEM paper, but there is no corresponding source code available. I need your help to generate the Python code that can reproduce the picture based on the picture I provide. Note that it is necessary to use proper figsize to set the image size to match the original size. Now, please give me the matplotlib code that reproduces the picture below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn magic_energy<D: Dim>(q: D) -> Energy = | |
if is_zero(q) | |
then 0 | |
else if is_dimensionless(q / s) # q is a time: E = h / q | |
then ℎ / quantity_cast(q, s) | |
else if is_dimensionless(q * s) # q is a frequency: E = h *q | |
then ℎ * quantity_cast(q, 1/s) | |
else if is_dimensionless(q / K) # q is a temperature: E = k_B T | |
then k_B quantity_cast(q, K) | |
else if is_dimensionless(q / m) # q is a wavelength: E = ℎ c / λ |
I will give you a long post and ask you to exract tags from it. I will also give you list of example tags from past posts. Here are some example tags:
- PCSEL
- Nanotube
- Lens
- Optics
- Flexure
- RSA
- Microwave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
# Parameters | |
n_grid = 500 | |
# Create the meshgrid | |
xs, ys = np.meshgrid(np.arange(1, n_grid+1), np.arange(1, n_grid+1)) | |
# Reshape the grids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Get a list of all TIF files in the current folder | |
tifFiles = dir('*.tif'); | |
% Loop through each TIF file | |
for i = 1:length(tifFiles) | |
% Read the TIF file | |
tifFileName = tifFiles(i).name; | |
tifData = imread(tifFileName); | |
% Convert to PNG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pya | |
class AreaCalculator(pya.QDialog): | |
""" | |
This class implements a dialog for calculating area of shapes | |
in a layout. The calculator adds up shapes in the currently | |
selected cell and below. | |
""" | |
def button_clicked(self, checked): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to override the defaults | |
[ | |
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" }, | |
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" }, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
# JEOL jdf & sdf file syntax highlight for sublime | |
# WTJ, 20180316 | |
# See http://www.sublimetext.com/docs/3/syntax.html | |
file_extensions: | |
- jdf | |
- sdf | |
scope: source.example-c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rpn | |
% simple rpn (Reverse Polish notation) calculator | |
% | |
% WTJ | |
% 20180113 | |
fprintf(['Reverse Polish notation calculator. Type h or help to see available functions.'... | |
'\n\tWentao Jiang, 20180113\n']); | |
stack = NaN(10000); | |
ind = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Thu Jan 4 20:02:31 2018 | |
@author: linqs-wentao | |
""" | |
class fiberpull: | |
def __init__(self, ctrlraddr, d0_fiber=2, d_fiber=1, t_heat=10): |
NewerOlder