Created
November 8, 2010 11:18
-
-
Save jmbr/667599 to your computer and use it in GitHub Desktop.
Plotting a coarse-grained model of (part of) a protein with PLPlot. This library apparently doesn't feature interactive rotation capabilities (version 5.9.7).
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
/* gcc -Wall -std=c99 plplotline3.c -o plplotline3 -lplplotd */ | |
#include <stddef.h> | |
#include <plplot/plplot.h> | |
int main(void) | |
{ | |
const size_t num_atoms = 10; | |
const double positions[][3] = {{ 13.935, 18.529, 29.843 }, { 13.088, 19.661, 26.283 }, { 12.726, 17.033, 23.612 }, { 12.179, 17.659, 19.887 }, { 10.253, 15.79, 17.221 }, { 11.082, 16.103, 13.475 }, { 8.009, 15.163, 11.389 }, { 8.628, 13.975, 7.913 }, { 5.213, 12.642, 6.966 }, { 3.589, 12.601, 3.497 }}; | |
plsdev("wxwidgets"); | |
plinit(); | |
PLFLT x[num_atoms], y[num_atoms], z[num_atoms]; | |
for (int i = 0; i < num_atoms; i++) { | |
x[i] = positions[i][0]; | |
y[i] = positions[i][1]; | |
z[i] = positions[i][2]; | |
} | |
plenv(-50, 50, -50, 50, 1, 0); | |
plw3d(10, 10, 30, -20, 20, -20, 20, -20, 20, 0, 0); | |
plline3(num_atoms, (PLFLT *) &x, (PLFLT *) &y, (PLFLT *) &z); | |
plend(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment