Saturday, November 17, 2012

subaxis

subaxis allows you to adjust the spacing in a subplot. Use subaxis instead of subplot.

% To fill the first column of a 4 by 3 plot:

h = subaxis(4,3,(i*3-2), 'Spacing', 0.045);

Monday, October 29, 2012

rounded buttons

Say you want some rounded buttons on a webpage, and you make your buttons in Powerpoint because you don't know what else to do. You may run in to problems for cropping those rounded buttons because most crop programs make only exact rectangles.

Here is a solution:

  1. Make the buttons in Powerpoint (or Illustrator)
  2. If you made them in powerpoint, screenshot a high resolution version (I did this from opening a PDF saved from the Powerpoint in Illustrator.)
  3. Open screenshot in Photoshop. (mine was a .png)
  4. Press "C" to open the crop tool and crop close in to the button, then press "return" to crop.
  5. If your button is outlined, press "W" for the wand tool and click to outline the surrounding area outside the button.
  6. With the outside area highlighted, press "delete"
  7. Save for a web device, GIF, transparency "background color" (this will make the area around the button transparent so you can have rounded buttons)
Here's an example of the result:

remove unwanted link underlining

Some website templates will automatically underline any links you have, even image links, which is a little unsightly.

You can get rid of it by surrounding the image with a div style tag:

<div style="text-decoration: none;"> </div>

And to display greater than or less than signs in html (like above) you can use &lt; and &gt;

Monday, October 22, 2012

TeX stack exchange

What are all of these sites, too many to keep track of:

http://tex.stackexchange.com/

This is a collaboratively edited question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Posts 4, 12, 18, 18, and 19 minutes ago...

Thursday, October 4, 2012

software carpentry

This site is designed to "help scientists be more productive by teaching them basic computing skills."

http://software-carpentry.org/

It looks potentially super useful. There are MATLAB, python, and versioning sections, among many others.

Saturday, September 8, 2012

figures in latex

Q: I want to put a figure into a latex document. I am trying things, but the image is not appearing when I compile it.

A: You need to use:
 \usepackage[pdftex]{graphicx} instead of
\usepackage[dvips]{graphicx}.

[klf]

Monday, August 13, 2012

shading flat

plot without mesh lines:


shading flat;  % remove the black mesh lines



Saturday, August 4, 2012

histc, histogram count

http://www.mathworks.com/help/techdoc/ref/histc.html

n = histc(x,edges) counts the number of values in vector x that fall between the elements in the edges vector (which must contain monotonically nondecreasing values). n is a length(edges) vector containing these counts

Very useful. Plot histogram points instead of bar graph. Need to calculate bin centers and use as x values. Divide the result of histc by the length(x) to get the y values. Plot.

Friday, July 6, 2012

illustrator shortcuts

After decades of using Illustrator in a dumb way (okay maybe only 1.4 decades), I learned a few key points.

  • If tracing an original, make it a layer, name it, and lock it.
  • Make a new layer, name it, and draw on it. 
  • Use shortcut Z, zoom
  • Use shortcut V, arrow
  • Use shortcut [space], hand
  • Use the different "corner" options (near the stroke box) so they're not pointy or pointy.
I think that's all.

Wednesday, June 20, 2012

vectorizing an image

Vector Magic

http://vectormagic.com/home

Takes an image that may become pixelated upon enlargement and vectorizes it into .pdf or other format. I used it for a logo that we wanted to blow up for a banner. Pretty neat. Two free conversions.

Tuesday, June 5, 2012

artboard size in Illustrator

Adobe Illustrator is yet another program that I have never fully grasped. 

But here's how to change the size of the "Artboard" (corresponding to the "page", and holding the artwork that is printed or saved as PDF).

File > Document Setup > Edit Artboards

You should get a drag-able box. 

Useful if you want to scale a 6-inch image by 1000% for a banner. 

Wednesday, May 2, 2012

tables are out, DL, DT, DD is in

Some info on using definition lists to make table-like displays that are more maintainable:

http://www.onextrapixel.com/2009/05/13/how-to-use-dl-dt-and-dd-html-tags-to-list-data-vs-table-list-data/

http://www.maxdesign.com.au/articles/definition/

You can add the style information to the .css or to the top of the html page to test e.g.

style type="text/css"
dl dd { padding-bottom:0.5em; }
dl dt {float:left;} dt {text-align:left; width:8em;}
dl dd {margin-left:9em;}
dl { padding-bottom:0.5em; }

(add style tags before and after)


Thursday, January 5, 2012

finding and indexing in matlab

This is something as ridiculous as in 2001 when I didn't know how to use .ppt so I just made .html presentations.

Well I don't know procedural SQL so I'm using matlab to find and index things.

The problem:
I had a big table in a database and you want to fill in a certain column with an index that depends on other relationships in that table.  (Basically, filling in parent-child relationships but each row has several identifiers: name, unique ID, other unique ID.)

The first loop demonstrates how to use "find" with strings: find the index in the array "name" where the cell value (string) equals input_name(i).

for i = 1:length(input_name)
    igsn_output(i) = igsn(find(ismember(name, input_name(i))==1))
end
igsn_output = transpose(igsn_output);

This second one is just weird, it was giving string/cell/ etc. errors but this worked (input_parent was a number but in a cell array).

for i = 1:length(input_name)
    parent_id_output{i} = cell2mat(sample_id(find(ismember(igsn, input_parent(i))==1)))
end
parent_id_output = transpose(parent_id_output);

I pasted it all into excel and then used "concatenate" to form the SQL statements.

This all could've been done in the SQL environment if I knew procedural postgreSQL.

They shouldn't let scientists code.