<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Make_Figures</id>
	<title>Make Figures - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/index.php?action=history&amp;feed=atom&amp;title=Make_Figures"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Make_Figures&amp;action=history"/>
	<updated>2026-05-06T15:22:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Make_Figures&amp;diff=6921&amp;oldid=prev</id>
		<title>Pyadmin: 1 revision</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Make_Figures&amp;diff=6921&amp;oldid=prev"/>
		<updated>2014-03-28T01:53:13Z</updated>

		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:53, 28 March 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pyadmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Make_Figures&amp;diff=6920&amp;oldid=prev</id>
		<title>MartinChristen: New script to easily create figures. ~~~~</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Make_Figures&amp;diff=6920&amp;oldid=prev"/>
		<updated>2013-02-13T16:56:46Z</updated>

		<summary type="html">&lt;p&gt;New script to easily create figures. ~~~~&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
This script will aid you in making publication quality figures for the currently displayed scene.&lt;br /&gt;
It understands a variety of preset &amp;quot;modes&amp;quot; and sizes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
make_figure filename [, mode] [, size (default=900 pixels)] [,opaque]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters are:&lt;br /&gt;
&lt;br /&gt;
'''filename''' : The name of the resulting image file.&lt;br /&gt;
::''The extension '''.png''' is added automatically.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''NOTE'': if no further arguments are given, the script generates quick figures for general use:&lt;br /&gt;
::* figures are not ray-traced&lt;br /&gt;
::* TWO figures at 300 x 300 px, 72 dpi&lt;br /&gt;
::* views are rotated 180° about y (front and back view)&lt;br /&gt;
::* _front_quick and _back_quick are appended to the filename&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''mode''' : Type of figure desired. Possible values are as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::'''''single''''' = &amp;quot;single view&amp;quot;&lt;br /&gt;
::* one ray-traced 300 dpi figure of the current view&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::'''''fb''''' = &amp;quot;front and back view&amp;quot;&lt;br /&gt;
::* TWO ray-traced 300 dpi figures&lt;br /&gt;
::* views are rotated 180° about y&lt;br /&gt;
::* _front and _back are appended to the filename&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
::'''''sides''''' = &amp;quot;four side views&amp;quot;&lt;br /&gt;
::* FOUR ray-traced 300 dpi figures&lt;br /&gt;
::* view is incrementally rotated by 90° about y&lt;br /&gt;
::* _1, _2, _3, and _4 are appended to the filename&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::'''''stereo''''' = &amp;quot;stereoview&amp;quot;&lt;br /&gt;
::* TWO ray-traced 300 dpi figures&lt;br /&gt;
::* views are shifted by +/- 3 degrees&lt;br /&gt;
::* image dimensions are fixed at 750 x 750 pixels (size arguments are ignored)&lt;br /&gt;
::* _L and _R are appended to the filename&lt;br /&gt;
::* the output files are meant to be combined side by side to generate a stereo image&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''size''' : Size of the figure(s) in pixels or in &amp;quot;panels&amp;quot;&lt;br /&gt;
::* DEFAULT = 900 pixels if a mode is specified&lt;br /&gt;
::* if size is 12 or smaller, the script interprets it as a number of &amp;quot;panels&amp;quot; to make.&lt;br /&gt;
::* panel sizes in pixels are hardcoded in the source but can easily be modified.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''opaque''' : Create an opaque background.&lt;br /&gt;
::* By default the figure background is 100% transparent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#quick 'n' dirty front and back views of the scene&lt;br /&gt;
#300x300 pixels at 72 dpi, transparent background&lt;br /&gt;
# filenames will be output_front_quick.png and output_back_quick.png&lt;br /&gt;
make_figure output&lt;br /&gt;
&lt;br /&gt;
# one ray-traced PNG file 975x975 pixels at 300dpi, with opaque background&lt;br /&gt;
# filename will be output.png&lt;br /&gt;
make_figure output, single, 975, opaque&lt;br /&gt;
&lt;br /&gt;
# two panels (1350x1350 px each at 300dpi) of the &amp;quot;front&amp;quot; and &amp;quot;back&amp;quot; view on transparent background&lt;br /&gt;
# filenames will be output_front.png and output_back.png&lt;br /&gt;
make_figure output, fb, 2&lt;br /&gt;
&lt;br /&gt;
# four panels (900x900 px each) where the view is incrementally rotated by 90° about y, transparent background&lt;br /&gt;
# filenames will be output_1.png, output_2.png, output_3.png and output_4.png&lt;br /&gt;
make_figure output, sides,4&lt;br /&gt;
&lt;br /&gt;
#stereoview of the current scene with opaque background&lt;br /&gt;
#size is fixed to 2x 750x750px&lt;br /&gt;
# filenames will be output_L.png and output_R.png&lt;br /&gt;
make_figure output, stereo, opaque&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= The Code =&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#make_figure v.3.0&lt;br /&gt;
#Copyleft Martin Christen, 2010&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
def make_figure(output='', mode='',size=900,opaque='transparent'):&lt;br /&gt;
&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
AUTHOR&lt;br /&gt;
&lt;br /&gt;
	Martin Christen&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
&lt;br /&gt;
	&amp;quot;make_figure&amp;quot; creates publication-quality figures of the current scene.&lt;br /&gt;
	It understands several predefined &amp;quot;modes&amp;quot; and sizes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
&lt;br /&gt;
	make_figure filename [, mode] [, size (default=900 pixels)] [,opaque]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ARGUMENTS&lt;br /&gt;
&lt;br /&gt;
	mode = string: type of desired figure (single, fb, sides, stereo or -nothing-)&lt;br /&gt;
	size = integer: size of the figure in pixels OR # panels (if &amp;lt;= 12)&lt;br /&gt;
	opaque = specify an opaque background.&lt;br /&gt;
	         By default, the script makes the background transparent.&lt;br /&gt;
EXAMPLES&lt;br /&gt;
&lt;br /&gt;
	make_figure output&lt;br /&gt;
	make_figure output, single, 975, opaque&lt;br /&gt;
	make_figure output, fb, 2&lt;br /&gt;
	make_figure output, sides,4&lt;br /&gt;
	make_figure output, stereo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTES&lt;br /&gt;
&lt;br /&gt;
	&amp;quot;single&amp;quot; mode makes a single 300 dpi figure&lt;br /&gt;
	&lt;br /&gt;
	&amp;quot;fb&amp;quot; mode makes TWO 300 dpi figure&lt;br /&gt;
	(&amp;quot;front&amp;quot; and &amp;quot;back&amp;quot;, rotating by 180 degrees about y)&lt;br /&gt;
	&lt;br /&gt;
	&amp;quot;sides&amp;quot; mode makes FOUR 300 dpi figures&lt;br /&gt;
	(&amp;quot;front&amp;quot; &amp;quot;left&amp;quot; &amp;quot;right&amp;quot; and back, rotating by 90 degrees clockwise about y)&lt;br /&gt;
	&lt;br /&gt;
	&amp;quot;stereo&amp;quot; generates two 300 dpi, 750 px figures&lt;br /&gt;
	(&amp;quot;L&amp;quot; and &amp;quot;R&amp;quot;, to be combined as a stereo image)&lt;br /&gt;
	If you specify the stereo mode, the size argument is IGNORED.&lt;br /&gt;
		&lt;br /&gt;
	If no mode argument is given, the script generates quick figures&lt;br /&gt;
	for general	use: TWO figures (front and back) at 300 x 300 px, 72 dpi.&lt;br /&gt;
	&lt;br /&gt;
	Size is interpreted as pixels, except if the number is ridiculously small&lt;br /&gt;
	(&amp;lt;=12),	in which case the script as &amp;quot;number of panels&amp;quot; to make.&lt;br /&gt;
&lt;br /&gt;
	Edit the script manually to define corresponding values.&lt;br /&gt;
	&lt;br /&gt;
	&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	#define sizes here (in pixels)&lt;br /&gt;
	panel1 = 1800&lt;br /&gt;
	panel2 = 1350&lt;br /&gt;
	panel3 = 900&lt;br /&gt;
	panel4 = 900&lt;br /&gt;
	panel5 = 750&lt;br /&gt;
	panel6 = 750&lt;br /&gt;
	panel7 = 675&lt;br /&gt;
	panel8 = 675&lt;br /&gt;
	panel9 = 600&lt;br /&gt;
	panel10 = 585&lt;br /&gt;
	panel11 = 585&lt;br /&gt;
	panel12 = 585&lt;br /&gt;
	&lt;br /&gt;
	#verify size is an integer number and convert to pixels&lt;br /&gt;
	size = int(size)&lt;br /&gt;
	if size &amp;gt; 12:&lt;br /&gt;
		pixels = size&lt;br /&gt;
	&lt;br /&gt;
	elif size == 1:&lt;br /&gt;
		pixels = panel1&lt;br /&gt;
	&lt;br /&gt;
	elif size == 2:&lt;br /&gt;
		pixels = panel2&lt;br /&gt;
	&lt;br /&gt;
	elif size == 3:&lt;br /&gt;
		pixels = panel3&lt;br /&gt;
	&lt;br /&gt;
	elif size == 4:&lt;br /&gt;
		pixels = panel4&lt;br /&gt;
	&lt;br /&gt;
	elif size == 5:&lt;br /&gt;
		pixels = panel5&lt;br /&gt;
	&lt;br /&gt;
	elif size == 6:&lt;br /&gt;
		pixels = panel6&lt;br /&gt;
	&lt;br /&gt;
	elif size == 7:&lt;br /&gt;
		pixels = panel7&lt;br /&gt;
	&lt;br /&gt;
	elif size == 8:&lt;br /&gt;
		pixels = panel8&lt;br /&gt;
	&lt;br /&gt;
	elif size == 9:&lt;br /&gt;
		pixels = panel9&lt;br /&gt;
	&lt;br /&gt;
	elif size == 10:&lt;br /&gt;
		pixels = panel10&lt;br /&gt;
	&lt;br /&gt;
	elif size == 11:&lt;br /&gt;
		pixels = panel11&lt;br /&gt;
	&lt;br /&gt;
	elif size == 3:&lt;br /&gt;
		pixels = panel12&lt;br /&gt;
&lt;br /&gt;
	#change background&lt;br /&gt;
	cmd.unset('opaque_background')&lt;br /&gt;
	if opaque == 'opaque':&lt;br /&gt;
		cmd.set('opaque_background')&lt;br /&gt;
	&lt;br /&gt;
	#apply mode&lt;br /&gt;
	if output == '':&lt;br /&gt;
		print 'no output filename defined\n'&lt;br /&gt;
		print 'try: \'make_figure filename\''&lt;br /&gt;
		return -1&lt;br /&gt;
		# abort if no output file name given&lt;br /&gt;
&lt;br /&gt;
	if mode =='':&lt;br /&gt;
		cmd.set('surface_quality',1)&lt;br /&gt;
		cmd.set('opaque_background')&lt;br /&gt;
		cmd.png(output+&amp;quot;_back_quick&amp;quot;,300,300,dpi=72)&lt;br /&gt;
		cmd.turn('y',180)&lt;br /&gt;
		cmd.png(output+&amp;quot;_front_quick&amp;quot;,300,300,dpi=72)&lt;br /&gt;
		cmd.turn('y',180)&lt;br /&gt;
		cmd.set('surface_quality',0)&lt;br /&gt;
		# make front and back figures for quick mode&lt;br /&gt;
&lt;br /&gt;
	elif mode == 'single':&lt;br /&gt;
		cmd.set('surface_quality',1)&lt;br /&gt;
		cmd.set('ray_shadow',0)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output, dpi=300)&lt;br /&gt;
		cmd.set('surface_quality',0)&lt;br /&gt;
		# make a figure for single mode&lt;br /&gt;
		&lt;br /&gt;
	elif mode == 'fb':&lt;br /&gt;
		cmd.set('surface_quality',1)&lt;br /&gt;
		cmd.set('ray_shadow',0)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output+&amp;quot;_front&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.turn('y',180)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output+&amp;quot;_back&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.turn('y',180)&lt;br /&gt;
		cmd.set('surface_quality',0)&lt;br /&gt;
		# make front and back figures for single mode&lt;br /&gt;
&lt;br /&gt;
	elif mode == 'sides':&lt;br /&gt;
		cmd.set('surface_quality',1)&lt;br /&gt;
		cmd.set('ray_shadow',0)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output+&amp;quot;_1&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.turn('y',90)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output+&amp;quot;_2&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.turn('y',90)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output+&amp;quot;_3&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.turn('y',90)&lt;br /&gt;
		cmd.ray(pixels, pixels)&lt;br /&gt;
		cmd.png(output+&amp;quot;_4&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.turn('y',90)&lt;br /&gt;
		cmd.set('surface_quality',0)&lt;br /&gt;
		# make front and back figures for single mode&lt;br /&gt;
		&lt;br /&gt;
	elif mode == 'stereo':&lt;br /&gt;
		cmd.set('surface_quality',1)&lt;br /&gt;
		cmd.set('ray_shadow',0)&lt;br /&gt;
		cmd.ray(750, 750, angle=-3)&lt;br /&gt;
		cmd.png(output+&amp;quot;_R&amp;quot;, dpi=300)&lt;br /&gt;
		cmd.ray(750, 750, angle=3)&lt;br /&gt;
		cmd.png(output+&amp;quot;_L&amp;quot;, dpi=300)&lt;br /&gt;
		# make stereo figure (for more control use stereo_ray)&lt;br /&gt;
		&lt;br /&gt;
cmd.extend('make_figure',make_figure)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;br /&gt;
[[Category:UI_Scripts]]&lt;/div&gt;</summary>
		<author><name>MartinChristen</name></author>
	</entry>
</feed>