The website of Lei Chen

Sunshine and rain of a developer

Archive for the ‘Misc’ Category

Output eps files from R

Posted by hide1713 on May 10, 2009

R is a very good statistical tools.  This guide teach you how to output eps or other formats from R.

R treats output sources as a device, so we must assign a device first( the default device is X windows).

postscript(“RPlot.eps”, height = 4, width = 4, horizontal = FALSE, onefile = FALSE, paper = “special”)

plot(1:5)

dev.off()

The firs line opens a device. The second line draws the graph. The third line saves the graph.

Posted in Misc | Leave a Comment »

How to display source code in wordpress.com

Posted by hide1713 on November 7, 2008

How do I post source code?

We have a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:
Wrap your code in these tags

..

Do not copy and paste this code – write it out. You can replace the language with one of the following language codes:

* cpp
* csharp
* css
* delphi
* html
* java
* jscript
* php
* python
* ruby
* sql
* vb
* xml

The language attribute is required! If we don’t have what you need pick the closest.
Code in between the tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

We used the syntaxhighlighter Google Code project by Alex Gorbatchev to implement this feature.

Posted in Misc | Tagged: | Leave a Comment »